FS#80316 - [erlang] Compile jinterface with --release 11 or lower

Attached to Project: Arch Linux
Opened by Kauron (kauron) - Tuesday, 21 November 2023, 17:49 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:21 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Erlang includes jinterface, a Java interface to execute remote calls on Erlang servers. This package includes a compiled version (/usr/lib/erlang/lib/jinterface-*/priv/OtpErlang.jar). However, this jar has been compiled with the latest version of Java (21) and without any compatibility settings, and thus cannot be run with older version of Java, including versions packaged and supported by Arch (8, 11, 17).

Proposed solution:

The solution would be to insert `--release NUM` to compile with backwards compatibility. Ideally, NUM=8, but that's deprecated in Java 21. I've been searching for the place to insert this flag in jinterface's source code, but I can't find the compilation step, all I can find is the jar creation at lib/jinterface-*/java_src/com/ericsson/otp/erlang/Makefile.

Another solution is to add a makedepends on Java 8, so that the build environment builds for Java 8 by default, and the resulting jar is valid for all versions of Java packaged in Arch.

Additional info:
* Package version: erlang 26.1.1-1

Steps to reproduce:

1. Install Erlang and Java 11 (pacman -S erlang jdk11-openjdk)
2. Set the Java version to 11 (archlinux-java set java-11-openjdk)
3. Run any application that uses jinterface, dummy command: java -cp /usr/lib/erlang/lib/jinterface-*/priv/OtpErlang.jar com.ericsson.otp.erlang.OtpErlangBinary
4. The output indicates that the jar has been compiled for a newer version of Java:
java.lang.UnsupportedClassVersionError: com/ericsson/otp/erlang/OtpErlangBinary has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 55.0
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:21 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/erlang/issues/1
Comment by Kauron (kauron) - Tuesday, 21 November 2023, 18:21 GMT
I tried building the package to see the JAVAC command. It uses $JAVA_OPTIONS, so probably the change should be to add the following statement to the prepare function:

sed -i 's/^JAVA_OPTIONS =/JAVA_OPTIONS = --release 8/g' lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile

In a future release, it might be necessary to either raise the --release value or set a lower dependence for jdk to build, as each new version of Java deprecates compiler compatibility with earlier versions (right now 8 is deprecated on JDK 21, but it works).

Loading...