Compile Java libs on MacOS - jni.h

46 views
Skip to first unread message

David Seide

unread,
Oct 23, 2020, 8:42:45 AM10/23/20
to wiredtiger-users
Hello everybody,

I want to compile wiredtiger libs on MacOS with Java support (already done on Windows and Linux without problems). On MacOS I encountered a problem and wanted to share so everyone can benefit from it.

./configure --prefix=/Users/dseide/wt_mac/wtinstall --enable-java --enable-lz4
ends with:
checking for SWIG library... /usr/local/Cellar/swig/4.0.2/share/swig/4.0.2
checking if javac works... yes
checking for jar... jar
checking for javac... /usr/bin/javac
checking symlink for /usr/bin/javac... /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
checking /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h usability... no
checking /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h presence... no
checking for /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h... no
checking /System/Library/Frameworks/JavaVM.framework/Versions/include/jni.h usability... no
checking /System/Library/Frameworks/JavaVM.framework/Versions/include/jni.h presence... no
checking for /System/Library/Frameworks/JavaVM.framework/Versions/include/jni.h... no
configure: error: cannot find JDK header files

I tried with AdoptOpenJdk 8, 11 15, and OracleJdk 11, 15 (always changing the JAVA_HOME).
After looking into config.log, I realized that the real problem is that jni.h includes jni_md.h (and maybe jawt_md.h?). Those files are located in the subfolder darwin. Creating a symbolic link made this work in the end.

I guess the configure script and jni.h includes have to be modified for compilation on MacOS.

Cheers,
David

Reply all
Reply to author
Forward
0 new messages