Mac Java 11 vs Java 8 dylib dlopen error: Cannot load libzstd.1.dylib

Viewed 303

I have a libhadoopzstd.dylib that is part of a JNI Hadoop ZSTD implementation.

libhadoopzstd.dylib contains dlopen calls to a second dylib - libzstd.1.dylib - assumed to be available locally.

Everything works fine on Java 8 (AdoptOpenJdk 1.8.0.211). Running the same code with the Java 11 (AdoptOpenJdk 11.0.8) compiler and the Java 11 Runtime results in the following error:

Error loading zstandard native libraries: java.lang.InternalError: Cannot load libzstd.1.dylib (dlopen(libzstd.1.dylib, 9): image not found)!

I've confirmed that libzstd.1.dylib is present in /usr/local/lib. I've also tried to explicitly point LD_LIBRARY_PATH and java.system.path to the libzstd dylib when running the java program.

I've inserted print statements in the original C code, and recompiled the libhadoopzstd.dylib to try and figure out what paths dlopen is searching for dylib files in. Oddly enough, the LD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH and JAVA_LIBRARY_PATH all show up as null from within libhadoopzstd.dylib.

Since the only difference is the Java version, I think Java 11 is doing something different with paths that Java 8 is not. Does anyone know whether this is true?

Furthermore, anyone know what paths dlopen searches when run from within the JVM? And how one can confirm this?

0 Answers
Related