Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find 'jni.h' error on MacOS #7

Open
oyendrila-dobe opened this issue Jan 11, 2022 · 1 comment
Open

Cannot find 'jni.h' error on MacOS #7

oyendrila-dobe opened this issue Jan 11, 2022 · 1 comment

Comments

@oyendrila-dobe
Copy link

oyendrila-dobe commented Jan 11, 2022

I'm trying to compile slsqp4j on MacOS. My gradle details are:

Gradle 6.9.1
------------------------------------------------------------

Build time:   2021-08-20 11:15:18 UTC
Revision:     f0ddb54aaae0e44f0a7209c3c0274d506ea742a0

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          16.0.1 (AdoptOpenJDK 16.0.1+9)
OS:           Mac OS X 11.1 x86_64

My JAVA_HOME is set to the home directory of the above java version and jni.h exists in the include directory inside it. On gradle clean build I am encountering fatal error: jni.h: No such file or directory. I'm looking for any help to understand why the error is occurring.

Here is the full gradle output:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/oyendriladobe/Documents/Research/HyperSMC_on_MDP/hypersmc/ressources/slsqp4j-39048b6ea9e803ada803bd2c48eb8fb3816cef71/build.gradle' line: 18

* What went wrong:
A problem occurred evaluating root project 'slsqp4j'.
> Could not find method libraries() for arguments [build_2nibyfuoeyzzsnywv625n8q8o$_run_closure1$_closure2@3bb1e1a9] on project ':slsqp4j' of type org.gradle.api.Project.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s
oyendriladobe@MacBook-Pro-5 slsqp4j-39048b6ea9e803ada803bd2c48eb8fb3816cef71 % /usr/local/Cellar/gradle@6/6.9.1/bin/gradle clean build

> Configure project :slsqp4j
Java home /usr/local/Cellar/openjdk@11/11.0.12/libexec/openjdk.jdk/Contents/Home

> Task :slsqp4j:compileC FAILED
/Users/oyendriladobe/Documents/Research/HyperSMC_on_MDP/hypersmc/ressources/slsqp4j-39048b6ea9e803ada803bd2c48eb8fb3816cef71/slsqp4j/src/jni/c/slsqp.c:45:10: fatal error: jni.h: No such file or directory
   45 | #include <jni.h>
      |          ^~~~~~~
compilation terminated.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':slsqp4j:compileC'.
> Process 'command 'gcc-10'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
3 actionable tasks: 3 executed
@oyendrila-dobe
Copy link
Author

The issues here were two:

  • on this line the path /../include should be changed to /include.
  • I was using gradle 6.9.1 which wasn't compatible to java 16 I was using. Hence I had to downgrade to 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant