Skip to content

[Build] Unable to use CoreML: This binary was not compiled with CoreML support. #16230

Description

@gauravphoenix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:Javaissues related to the Java APIbuildbuild issues; typically submitted using templateplatform:mobileissues related to ONNX Runtime mobile; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions