Add support for openjdk-9, openjdk-10 and openjdk-11 (LTS)
Reported by Atri Bhattacharya
BUG DESCRIPTION:
----------------
I am the maintainer of scilab for openSUSE.
From http://openjdk.java.net/projects/jdk9/: JDK 9 reached General Availability on 21 September 2017. Soon after, openjdk-9 entered openSUSE:Factory (the bleeding edge of the distribution, and base for its next release) and was made the default java compiler. Since then the core java-based dependencies of scilab, including lucene, have been building against openjdk-9, while scilab (both 5.5.2 and 6.0.0) fails to build with this updated java with the following error message:
[ 25s] checking JAVA_HOME variable... JAVA_HOME variable found, use it as JVM root directory
[ 25s] checking for zip or jar files to include on CLASSPATH...
[ 26s] checking to see if the java compiler works... yes
[ 26s] Using JAVAC=/usr/lib64/jvm/java/bin/javac
[ 26s] Java found in /usr/lib64/jvm/java
[ 27s] checking type of jvm... jdk
[ 30s] checking java API version... 1.8
[ 30s] Using the following JNI include flags -I/usr/lib64/jvm/java/include -I/usr/lib64/jvm/java/include/linux
[ 30s] checking if jni.h can be included... yes
[ 30s] Looking for JNI libs with x86_64 as machine hardware name
[ 30s] Looking for /usr/lib64/jvm/java/jre/lib/x86_64/libjava.so
[ 30s] Looking for /usr/lib64/jvm/java/jre/lib/amd64/libjava.so
[ 30s] Looking for /usr/lib64/jvm/java/jre/lib/i386/client/libjvm.so
[ 30s] Looking for /usr/lib64/jvm/java/jre/bin/classic/libjvm.so
[ 30s] Looking for /usr/lib64/jvm/java/lib/jvm.lib
[ 30s] Looking for /usr/lib64/jvm/java/jre/lib/mipsel/libjava.so
[ 30s] configure: error: Could not detect the location of the Java
[ 30s] shared library. You will need to update java.m4
[ 30s] to add support for this JVM configuration.
[ 30s] error: Bad exit status from /var/tmp/rpm-tmp.lIeg0W (%build)
I tried patching the m4/java/m4 file to explicitly add support for the new location of libjava.so (/usr/lib64/jvm/java/lib/libjava.so) but then it fails with the following error:
[ 20s] checking JAVA_HOME variable... JAVA_HOME variable found, use it as JVM root directory
[ 20s] checking for zip or jar files to include on CLASSPATH...
[ 21s] checking to see if the java compiler works... yes
[ 21s] Using JAVAC=/usr/lib64/jvm/java/bin/javac
[ 21s] Java found in /usr/lib64/jvm/java
[ 22s] checking type of jvm... jdk
[ 25s] checking java API version... 1.8
[ 25s] Using the following JNI include flags -I/usr/lib64/jvm/java/include -I/usr/lib64/jvm/java/include/linux
[ 26s] checking if jni.h can be included... yes
[ 26s] Looking for JNI libs with x86_64 as machine hardware name
[ 26s] Looking for /usr/lib64/jvm/java/jre/lib/x86_64/libjava.so
[ 26s] Looking for /usr/lib64/jvm/java/jre/lib/amd64/libjava.so
[ 26s] Looking for /usr/lib64/jvm/java/lib/libjava.so
[ 26s] Found /usr/lib64/jvm/java/lib/libjava.so
[ 26s] Using the following JNI library flags -L/usr/lib64/jvm/java/lib -ljava -lverify -L/usr/lib64/jvm/java/jre/lib/amd64/server -ljvm
[ 26s] Using the following runtime library path /usr/lib64/jvm/java/lib:/usr/lib64/jvm/java/jre/lib/amd64/server
[ 26s] checking to see if we can link a JNI application... no
[ 26s] configure: error: could not link file that includes jni.h
[ 26s] Either the configure script does not know how to deal with
[ 26s] this JVM configuration or the JVM install is broken or corrupted.
[ 26s] error: Bad exit status from /var/tmp/rpm-tmp.Bz0ziq (%build)
Tried using openjdk-1.8.0, but the documentation fails to compile as lucene is already being compiled against java-9. We would have to probably switch all the java dependencies to build against 1.8.0 to get scilab compiling again. I don't think this will be acceptable for the distribution. Adding support for openjdk-9 will, therefore, be very welcome. OTOH if there is some quick way (hackish or not) to get around the present build failure, that would be helpful too.