Page 1 of 1

polymake config not finding jni headers

Posted: 21 Aug 2013, 13:50
by hampe
Heyho!

I'm using the most recent svn version of polymake and the ./configure is no longer recognizing my java. More precisely, the build.x86_64/bundled.log complains that

"java seems to belong to a pure Java runtime installation:
JNI headers (most prominently jni.h) were not found."

However, I have a JDK installed (both sun 1.6.0_26-b03 and openjdk 1.6.0_27 - sun is the default java) and both installations do include the jni.h. Both were installed using the package manager, no custom install options should have been chosen.

update-alternatives --list java
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-6-sun/jre/bin/java

locate jni.h
/usr/lib/jvm/java-6-openjdk-amd64/include/jni.h
/usr/lib/jvm/java-6-sun-1.6.0.26/include/jni.h

Before I start messing around with the --with-java option, is there some obvious defect here? Does polymake require a newer java? Or is this a bug? :) This used to work out of the box with earlier svn versions. I know Ewgenij sent an email around asking us to do a rebuild due to some changes to the java parts of polymake, so maybe this is related?

Re: polymake config not finding jni headers

Posted: 22 Aug 2013, 00:41
by gawrilow
The java-related part of autoconfiguration tries to deduce the location of jni.h from the path of the java binary. There are, however, too many different variants of subdirectories, symbolic links, etc. in the world. Probably your one is not yet reflected in the modest knowledge of the script. If you are curious enough, please look into the script bundled/java/configure.pl, starting at the line "locate JNI headers", and try to figure out why the code fails in your environment. I'd deeply appreciate any recommendations and improvements. But if you don't have enough time to investigate this mess, simply specify the path to jni.h on the configure command line: --with-jni-headers=/SOME/WHERE . Sorry for the trouble.

Re: polymake config not finding jni headers

Posted: 22 Aug 2013, 11:06
by hampe
I looked at the configure script for a bit and all I could find out was this:

As far as I understand, the script tries to locate the path to the java binary and saves it in $JAVACMD. This is then used to try several possible paths to the jni headers. However, all these approaches seem to depend on the fact that $JAVACMD is actually a path. However, in my case, $JAVACMD == "java". This is determined by Polymake::Configure::find_program, which seemed a bit too complicated to me to sort through right now ;-)

Re: polymake config not finding jni headers

Posted: 22 Aug 2013, 16:57
by gawrilow
Oh, thanks, this is a good advice anyway. I'm afraid, this script has been tested so far only on systems where the java binary location was deduced from environment variables like JAVA_HOME or JDK_HOME. I'll improve the script as to cover your case.

Re: polymake config not finding jni headers

Posted: 22 Aug 2013, 17:34
by gawrilow
Just submitted a fix, please try it out.

Re: polymake config not finding jni headers

Posted: 23 Aug 2013, 10:22
by hampe
Works perfectly now, thanks! :)