I get a build error because antlr is downloaded precompiled instead of using the system version. [342/788] cd /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars && /etc/java-config-2/current- system-vm/bin/java -Xmx1024m -jar /var/tmp/portage/dev-db/mysql-workbench-8.0.36/distdir/antlr-4.11.1-complete.jar -Dlanguage=Cpp -listener -visitor -o ../my sql -package parsers /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars/MySQLLexer.g4 /var/tmp /portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars/MySQLParser.g4 FAILED: /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLLexer.h /var/tmp/portage/dev-db/m ysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLLexer.tokens /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/m ysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParserBaseListener.h /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-commu nity-8.0.36-src/library/parsers/mysql/MySQLParserBaseVisitor.h /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/libra ry/parsers/mysql/MySQLParser.h /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParserList ener.h /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParser.tokens /var/tmp/portage/dev -db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParserVisitor.h /var/tmp/portage/dev-db/mysql-workbench-8.0.3 6/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLLexer.cpp /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-communit y-8.0.36-src/library/parsers/mysql/MySQLParserBaseListener.cpp /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/libra ry/parsers/mysql/MySQLParserBaseVisitor.cpp /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/My SQLParser.cpp /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParserListener.cpp /var/tmp /portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLParserVisitor.cpp cd /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars && /etc/java-config-2/current-system-vm/ bin/java -Xmx1024m -jar /var/tmp/portage/dev-db/mysql-workbench-8.0.36/distdir/antlr-4.11.1-complete.jar -Dlanguage=Cpp -listener -visitor -o ../mysql -packa ge parsers /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars/MySQLLexer.g4 /var/tmp/portage/d ev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/parsers/grammars/MySQLParser.g4 Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/antlr/v4/Tool has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621) I have the following configuration on my system: # eselect java-vm list Available Java Virtual Machines: [1] openjdk-bin-8 system-vm [2] openjdk-bin-17 It seems that the downloaded antlr version has been compiled with java-11 while version 8 is used during src_compile()
By using this patch I solved the problem: --- /usr/portage/dev-db/mysql-workbench/mysql-workbench-8.0.38.ebuild 2024-07-03 07:41:22.000000000 +0200 +++ /usr/portage/dev-db/mysql-workbench/mysql-workbench-8.0.38-r1.ebuild 2024-07-06 12:58:13.333185688 +0200 @@ -9,7 +9,13 @@ ANTLR_VERSION=4.11.1 -inherit gnome2 flag-o-matic python-single-r1 cmake +# Doesn't build with jre-8 +_JAVA_PKG_WANT_BUILD_VM=( openjdk{,-jre}{,-bin}-{17,21} ) +JAVA_PKG_WANT_BUILD_VM=${_JAVA_PKG_WANT_BUILD_VM[@]} +JAVA_PKG_WANT_SOURCE="11" +JAVA_PKG_WANT_TARGET="11" + +inherit gnome2 flag-o-matic java-utils-2 python-single-r1 cmake MY_P="${PN}-community-${PV}-src" @@ -71,6 +77,11 @@ "${FILESDIR}/${PN}-8.0.33-gcc13.patch" ) +pkg_setup() { + java-pkg_init + python-single-r1_pkg_setup +} + src_unpack() { unpack ${PN}-community-${PV}-src.tar.gz }
(In reply to Fabio Rossi from comment #1) > +JAVA_PKG_WANT_SOURCE="11" > +JAVA_PKG_WANT_TARGET="11" This would lock the ebuild to version 11 only when 17 (and perhaps 21) is also a viable option.
(In reply to Hans de Graaff from comment #2) > (In reply to Fabio Rossi from comment #1) > > > +JAVA_PKG_WANT_SOURCE="11" > > +JAVA_PKG_WANT_TARGET="11" > > This would lock the ebuild to version 11 only when 17 (and perhaps 21) is > also a viable option. Unfortunately this is how is implemented java-utils-2.eclass in java-pkg_switch-vm(). Do you know a better way?
the real problem is that antlr-tool was built with a newer java version than the one which is used to build mysql-workbench
(In reply to Fabio Rossi from comment #0) > I get a build error because antlr is downloaded precompiled instead of using > the system version. > > [342/788] cd > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/grammars && /etc/java-config-2/current- > system-vm/bin/java -Xmx1024m -jar > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/distdir/antlr-4.11.1-complete. > jar -Dlanguage=Cpp -listener -visitor -o ../my > sql -package parsers > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/grammars/MySQLLexer.g4 /var/tmp > /portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36- > src/library/parsers/grammars/MySQLParser.g4 > FAILED: > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/mysql/MySQLLexer.h > /var/tmp/portage/dev-db/m > ysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/ > parsers/mysql/MySQLLexer.tokens > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/m > ysql-workbench-community-8.0.36-src/library/parsers/mysql/ > MySQLParserBaseListener.h > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-commu > nity-8.0.36-src/library/parsers/mysql/MySQLParserBaseVisitor.h > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/libra > ry/parsers/mysql/MySQLParser.h > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/mysql/MySQLParserList > ener.h > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/mysql/MySQLParser.tokens > /var/tmp/portage/dev > -db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/library/ > parsers/mysql/MySQLParserVisitor.h > /var/tmp/portage/dev-db/mysql-workbench-8.0.3 > 6/work/mysql-workbench-community-8.0.36-src/library/parsers/mysql/MySQLLexer. > cpp > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-communit > y-8.0.36-src/library/parsers/mysql/MySQLParserBaseListener.cpp > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/libra > ry/parsers/mysql/MySQLParserBaseVisitor.cpp > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/mysql/My > SQLParser.cpp > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/mysql/MySQLParserListener.cpp /var/tmp > /portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36- > src/library/parsers/mysql/MySQLParserVisitor.cpp > cd > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/grammars && > /etc/java-config-2/current-system-vm/ > bin/java -Xmx1024m -jar > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/distdir/antlr-4.11.1-complete. > jar -Dlanguage=Cpp -listener -visitor -o ../mysql -packa > ge parsers > /var/tmp/portage/dev-db/mysql-workbench-8.0.36/work/mysql-workbench- > community-8.0.36-src/library/parsers/grammars/MySQLLexer.g4 > /var/tmp/portage/d > ev-db/mysql-workbench-8.0.36/work/mysql-workbench-community-8.0.36-src/ > library/parsers/grammars/MySQLParser.g4 > [...] this looks like there is java code generation involved. and then, what would it do with the freshly generated *.java files? to compile them, something would call javac which is available in a jdk but not in jre.