Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933844 - dev-db/mysql-workbench-8.0.36: virtual/jre>=11 is not forced at build time
Summary: dev-db/mysql-workbench-8.0.36: virtual/jre>=11 is not forced at build time
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Hans de Graaff
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2024-06-08 19:22 UTC by Fabio Rossi
Modified: 2024-08-02 18:11 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Rossi 2024-06-08 19:22:08 UTC
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()
Comment 1 Fabio Rossi 2024-07-06 11:06:43 UTC
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
 }
Comment 2 Hans de Graaff gentoo-dev Security 2024-07-07 05:05:27 UTC
(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.
Comment 3 Fabio Rossi 2024-07-08 08:19:06 UTC
(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?
Comment 4 Fabio Rossi 2024-07-08 08:20:50 UTC
the real problem is that antlr-tool was built with a newer java version than the one which is used to build mysql-workbench
Comment 5 Volkmar W. Pogatzki 2024-08-02 18:11:55 UTC
(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.