You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice that the native library for M1 Mac is located under the resource directory: ai/onnxruntime/native/osx-arm64/libonnxruntime.dylib. In OnnxRuntime.java implementation, however, the os/arch name constructed by the initOsArch method is osx-aarch64:
the OrtEnvironment class cannot be initialized due to the failure of loading the native library:
[info] java.lang.UnsatisfiedLinkError: no onnxruntime in java.library.path: [/Users/foo/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
[info] at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
[info] at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
[info] at java.base/java.lang.System.loadLibrary(System.java:1873)
[info] at ai.onnxruntime.OnnxRuntime.load(OnnxRuntime.java:338)
[info] at ai.onnxruntime.OnnxRuntime.init(OnnxRuntime.java:139)
[info] at ai.onnxruntime.OrtEnvironment.<clinit>(OrtEnvironment.java:29)
Urgency
none
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS Monterey 12.5 (M1 Chip)
ONNX Runtime installed from (source or binary): Binary
ONNX Runtime version: 1.12.0
Python version: N/A
Visual Studio version (if applicable):
GCC/Compiler version (if compiling from source):
CUDA/cuDNN version:
GPU model and memory:
To Reproduce
Describe steps/code to reproduce the behavior.
Simply calling the static method ai.onnxruntime.OrtEnvironment.getEnvironment() with onnxruntime1.12.0 Java package on a M1 Mac.
Expected behavior
My theory is that this error can be resolved by renaming the directory name from osx-arm64 to osx-aarch64 for the directory containing the native library.
Noticeably, the native library for Linux ARM is located under the directory: ai/onnxruntime/native/linux-aarch64. Therefore, the same treatment shall be applied to osx libraries as well.
The text was updated successfully, but these errors were encountered:
xydrolase
changed the title
Wrong native library name for M1 Mac in the Java package
Wrong native library directory name for M1 Mac in the Java package
Jul 26, 2022
Describe the bug
In the release notes of
1.12.0
, it was stated that M1 Mac support is now provided for theonnxruntime
Java package.Inspecting the published JAR file on Maven Repository: https://mvnrepository.com/artifact/com.microsoft.onnxruntime/onnxruntime/1.12.0, indeed there are now
libonnxruntime
andlibonnxruntime_jni
native libraries pre-built forosx-arm64
:Notice that the native library for M1 Mac is located under the resource directory:
ai/onnxruntime/native/osx-arm64/libonnxruntime.dylib
. InOnnxRuntime.java
implementation, however, the os/arch name constructed by theinitOsArch
method isosx-aarch64
:onnxruntime/java/src/main/java/ai/onnxruntime/OnnxRuntime.java
Lines 111 to 112 in f3dcbf5
Therefore, when running
onnxruntime
1.12.0
on a M1 Mac (which has theaarch64
arch):the
OrtEnvironment
class cannot be initialized due to the failure of loading the native library:Urgency
none
System information
To Reproduce
Simply calling the static method
ai.onnxruntime.OrtEnvironment.getEnvironment()
withonnxruntime
1.12.0
Java package on a M1 Mac.Expected behavior
My theory is that this error can be resolved by renaming the directory name from
osx-arm64
toosx-aarch64
for the directory containing the native library.Noticeably, the native library for Linux ARM is located under the directory:
ai/onnxruntime/native/linux-aarch64
. Therefore, the same treatment shall be applied toosx
libraries as well.The text was updated successfully, but these errors were encountered: