On Thu, 15 Sep 2022 11:54:41 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

> When trying to load a x64 lib on macOS aarch64 one got previously this 
> detailed message before 
> [JDK-8275703](https://bugs.openjdk.org/browse/JDK-8275703):
> 
> java.lang.UnsatisfiedLinkError: /testing/jco3/macOsx64/libsapjco3.dylib: 
> dlopen(/testing/jco3/macOsx64/libsapjco3.dylib, 1): no suitable image found. 
> Did find:

Adding the background and details for this review:

The `throwException` parameter in `JVM_LoadLibrary` was added to support 
dynamic linker cache.   dlopen may succeed when the given path does not exist 
but in the dynamic linker cache.   `System::loadLibrary` on macOS that supports 
dynamic linker cache calls `JVM_LoadLibrary` with `throwException == false` and 
so VM doesn't throw  `UnsatisfiedLinkException`.  Instead the libraries code 
throws `UnsatisfiedLinkException` if it fails to load the library.

For this issue,  a library to be loaded exists.    A simple fix is to call 
`JVM_LoadLibrary` with throwException = true such that the VM throws 
`UnsatisfiedLinkException` with the detailed error message.

-------------

PR: https://git.openjdk.org/jdk/pull/10286

Reply via email to