onnxruntime: [Build] Unable to use CoreML: This binary was not compiled with CoreML support.
Describe the issue
Hello, I am using the dependency -
<dependency>
<groupId>com.microsoft.onnxruntime</groupId>
<artifactId>onnxruntime</artifactId>
<version>1.15.0</version>
</dependency>
and with the following code-
var env = OrtEnvironment.getEnvironment();
var sessionOptions = new OrtSession.SessionOptions();
sessionOptions.addCoreML();
var session = env.createSession("model.onnx", sessionOptions);
I get error
Error code - ORT_INVALID_ARGUMENT - message: This binary was not compiled with CoreML support.
So I tried building the package myself like this-
./build.sh --update --build --build_java --config Release --parallel
but that gives an error
CMake Error at /opt/homebrew/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT)
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/Cellar/cmake/3.26.4/share/cmake/Modules/FindJNI.cmake:569 (find_package_handle_standard_args)
onnxruntime_java.cmake:11 (find_package)
CMakeLists.txt:1631 (include)
java -version output-
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Homebrew (build 17.0.7+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.7+0, mixed mode, sharing)
Any suggestion on how to go about fixing it? I would rather use pre-built binary than spend time resolving build issues
Urgency
No response
Target platform
macOS
Build script
./build.sh --update --build --build_java --config Release --parallel
Error / output
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT) Call Stack (most recent call first): /opt/homebrew/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /opt/homebrew/Cellar/cmake/3.26.4/share/cmake/Modules/FindJNI.cmake:569 (find_package_handle_standard_args) onnxruntime_java.cmake:11 (find_package) CMakeLists.txt:1631 (include)
Visual Studio Version
No response
GCC / Compiler Version
arm64-apple-darwin22.4.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 22 (15 by maintainers)
Commits related to this issue
- Fixing CoreML in Java (#16231) ### Description The name of the flag we set when compiling the JNI binding to enable the CoreML EP changed at some point in the past. This PR fixes it by updating the ... — committed to microsoft/onnxruntime by Craigacp a year ago
- Fixing CoreML in Java (#16231) ### Description The name of the flag we set when compiling the JNI binding to enable the CoreML EP changed at some point in the past. This PR fixes it by updating the ... — committed to Honry/onnxruntime by Craigacp a year ago
Thank you, @edgchen1 and @Craigacp; I was able to build the library and load an onnx model successfully after applying the changes that both of you have published.
FWIW, if anyone else is blocked, here are the steps-
checkout @edgchen1 's branch https://github.com/microsoft/onnxruntime/pull/15878 and then apply @Craigacp branch https://github.com/microsoft/onnxruntime/pull/16231
build using -
./build/MacOS/Release/java/build/libs/onnxruntime-1.16.0.jarNote that I am purposefully skipping tests here due to test failures, @edgchen1 - FYI.
I can reproduce them on my M1 Mac. Is there something I can capture that would help?
Yeah, I get it with and without
--use_coreml.