Open xydrolase opened 2 years ago
I created PR which is probably addressing this issue in #12325 and is related to the discussion in #11054.
I created PR which is probably addressing this issue in #12325 and is related to the discussion in #11054.
Thanks for the pointers! The PR changes look good. Is there a SNAPSHOT version that we can use for testing?
If you build from source it packages the library correctly, there's something off with the packaging pipeline that makes the Maven Central jar.
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
:https://github.com/microsoft/onnxruntime/blob/f3dcbf539aa410f31a0e4bce1807f79331fe1c1f/java/src/main/java/ai/onnxruntime/OnnxRuntime.java#L111-L112
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
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.