Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

jniwrap fails to build with Java 8 #1320

Closed
kalxas opened this issue Mar 15, 2019 · 7 comments
Closed

jniwrap fails to build with Java 8 #1320

kalxas opened this issue Mar 15, 2019 · 7 comments
Labels

Comments

@kalxas
Copy link
Member

kalxas commented Mar 15, 2019

The jniwrap bindings fail to build with OpenJDK 8:

compile:
    [mkdir] Created dir: /<<PKGBUILDDIR>>/jniwrap/out
    [mkdir] Created dir: /<<PKGBUILDDIR>>/jniwrap/out/classes
    [javac] Compiling 4 source files to /<<PKGBUILDDIR>>/jniwrap/out/classes
    [javac] javac: invalid flag: --module-version
    [javac] Usage: javac <options> <source files>
    [javac] use -help for a list of possible options

BUILD FAILED
/<<PKGBUILDDIR>>/jniwrap/build.xml:23: Compile failed; see the compiler error output for details.

I see in #974 that this module has moved forward.
Is there any supported way to use OpenJDK 8?

@rouault
Copy link
Member

rouault commented Mar 15, 2019

CC @desruisseaux
I see Debian dropped the libproj-java package for PROJ 6 : https://salsa.debian.org/debian-gis-team/proj/commit/279b1c6f1f2d01eb105be2b49a5c7fa5e919ef4f
On Travis-CI, we have very minimal compile testing against OpenJDK 7

@desruisseaux
Copy link
Contributor

Indeed the requirement for JNI bindings moved to Java 9 in order to benefit from modularisation ("Jigsaw"). But it is possible to support also older Java versions using "multi-versions JAR file" or other approach. I have not done that because I didn't knew if there would be a demand. If this is the case I can do it.

One question however: is it okay to require Java 9+ at build time (but allow the compilation result to run on older Java versions), or is it required to build the project with older Java versions too? I ask because "multi-versions JAR files" is available only with Java 9+ compilers.

@rouault
Copy link
Member

rouault commented Mar 15, 2019

Indeed the requirement for JNI bindings moved to Java 9 in order to benefit from modularisation ("Jigsaw")

OK, actually I realize that Travis with OpenJDK 7 only tests the compilation of the native part of the Java bindings (and native JNI stuff must not be that much dependent of the Java version), but not the Java code itself.
Not sure if someone actually tested that the PROJ 6 Java binding works at runtime after all the work of the past months.

I don't have a strong opinion about which Java version we should support, but it would be interesting to have @sebastic feedback why he had to disable libproj-java: I would have assumed that Debian unstable/testing used a recent Java version.

@sebastic
Copy link
Contributor

The JNI bindings failed to build with OpenJDK 11 in Debian unstable. I don't have the buildlog for the details any more.

Since the libproj-java package isn't used by any other packages, and because it unblocks other packages on a couple of ports (see 837354), it was enough for me to decide to drop the package now.

@desruisseaux
Copy link
Contributor

The C/C++ side of JNI is very stable. As far as I know, the src/org_proj4_PJ.h file generated by Java 9 is practically identical to the file generated 15 years ago by Java 5. It is possible to compile the C code while ignoring the Java classes, if desired, and let Java developers compile the Java classes themselves for now.

On short term we can fix the build (I would have to check with Java 11 on my side) after a choice has been made about which minimal Java version to require. I'm neutral about whether it should be for this PROJ version or a next one. On medium term revisit the Java bindings in light of the new API available in PROJ, but I guess it would be the topic of another github ticket.

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 8, 2020
@kbevers
Copy link
Member

kbevers commented Jan 8, 2020

Since #1825 jni wrappers has been removed from PROJ. This issue no longer applies.

@kbevers kbevers closed this as completed Jan 8, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants