Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 805008

Summary: Can uninstall OpenJDK 8 with Libreoffice installed and updating Libreoffice doesn't bring it back
Product: Gentoo Linux Reporter: onkobu
Component: Current packagesAssignee: Java team <java>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 767136    
Bug Blocks:    
Attachments: emerge --info

Description onkobu 2021-07-29 09:58:05 UTC
The machine has libreoffice and openjdk-8 as well as openjdk-11 installed. Eselect doesn't list version 11 but version 8. With emerge -cav it is suggested to uninstall openjdk-8 which succeeds. After emerge --update @world also updating libreoffice the build breaks since there is no JDK 8 anymore. It is also not re-installed. Had to do this manually.

Eselect also showed the VM version 8 still installed while it wasn't.  Emerge --search openjdk listed all the packages with installed versions reported correctly.

Reproducible: Always

Steps to Reproduce:
0. have a working system with libreoffice and JDK 8 (the latter not part of @world or @system) as well as JDK 11
1. emerge -cav -> suggests to uninstall version 8 JDK
2. emerge with update of libreoffice
Actual Results:  
Libreoffice prepration fails during check of Ant.

Expected Results:  
Libreoffice either pulls in JDK 8 again and/ or emerge -cav doesn't clean JDK 8.

It'd be great to describe the current state of Java project in the Wiki. I'd do it, if I knew something about it. Maybe someone link a status page or something. There is still java-config as well as java-config2 available.

For more than three years I'm using JDKs and JVMs aside from those shipped by Gentoo. It is hard to get it right and Gentoo tries to be too clever. But with Maven toolchains, the changes of shipment with JDK 11 there should be only a single system VM for package building. All other tricks are up to the users/ developers.
Comment 1 Andreas Sturmlechner gentoo-dev 2021-07-29 16:07:41 UTC
LO does not build with JDK-8 at all. It requires JDK-11.
Comment 2 Andreas Sturmlechner gentoo-dev 2021-07-29 16:11:18 UTC
Also, eselect is irrelevant for building LO.

(In reply to onkobu from comment #0)
> After emerge --update @world also updating libreoffice the build breaks since
> there is no JDK 8 anymore.
If that is the case, then we need a builg.log.
Comment 3 jospezial 2021-08-01 17:58:12 UTC
<flag name="gentoo-vm">Allow this JDK to be recognised by Gentoo (package manager, eselect, java-config, EXPERIMENTAL!)</flag>
Comment 4 Andreas Sturmlechner gentoo-dev 2021-08-05 10:00:34 UTC
This bug can not be processed at all without further information.
Comment 5 onkobu 2021-08-12 21:15:45 UTC
On a server-machine running Gentoo emerge libreoffice yields amongst many others the last few:

…
[ebuild  NS    ] dev-java/openjdk-bin-8.292_p10 [11.0.11_p9-r1] USE="-examples%" 
[ebuild  N     ] virtual/jdk-1.8.0-r6  USE="-headless-awt" 
[ebuild  N     ] dev-java/ant-core-1.10.9  USE="-doc -source" 
[ebuild  N     ] x11-libs/gtk+-3.24.29  USE="X cups introspection xinerama (-aqua) -broadway -cloudprint -colord -examples -gtk-doc -sysprof -test -vim-syntax -wayland" 
[ebuild  N     ] x11-themes/adwaita-icon-theme-40.1.1  USE="-branding" 
[ebuild  N     ] app-office/libreoffice-7.1.3.2  USE="bluetooth branding cups dbus gtk java ldap mariadb pdfimport postgres -accessibility (-base) -clang (-coinmp) -custom-cflags -debug -eds (-firebird) -googledrive -gstreamer -kde -odk -test -vulkan" LIBREOFFICE_EXTENSIONS="-nlpsolver -scripting-beanshell -scripting-javascript -wiki-publisher" PYTHON_SINGLE_TARGET="python3_9 -python3_8"

On the desktop machine in question emerge -cav openjdk-bin =virtual/jdk-1.8.0-r6 ant-core yields (amongst others requiring virtual/jdk-1.8.0 or at least >1.7):

Calculating dependencies... done!
  dev-java/ant-core-1.10.9 pulled in by:
    app-office/libreoffice-7.1.3.2 requires dev-java/ant-core
    app-text/pdftk-3.2.2 requires >=dev-java/ant-core-1.8.2:0
    dev-libs/link-grammar-5.8.0 requires dev-java/ant-core
>>> No packages selected for removal by depclean

Now on the server machine without any libreoffice installation eselect java-vm list shows no VM at all.

The machine which had errors now settled:

- emerge -cav openjdk-bin wiped 11.x and kept 8.x, which is the system-vm

For some reason I was able to clean openjdk-bin-8, too which broke ant-core which is required by libreoffice. There are some pre-checks in libreoffice's build whether ant works which doesn't if JDK 8 is gone.

Now the dependencies are ok again after re-emerging openjdk-bin-8. Slots look like this (pay attention to the -bin):

equery l dev-java/openjdk*
 * Searching for openjdk* in dev-java ...
[IP-] [  ] dev-java/openjdk-11.0.11_p9-r1:11
[IP-] [  ] dev-java/openjdk-bin-8.292_p10:8

Finally as far as I understand the ebuild of Libreoffice DEPEND is populated with dev-java/ant-core as soon as USE contains java – which it does on my machine(s). Ebuild ant-core itself depends (CDEPEND=DEPEND=RDEPEND) on >=virtual/jdk-1.8:*. Since there are other packages on that machine that require JDK 8 (subversion, graphviz) it maybe picks up JDK 8 first and runs ant-core with this version – I have no idea why there is an eselect for a system-vm if it doesn't control the system vm used for builds.

I am aware that Gentoo's ant-core somehow bakes the JDK 8 into the runtime. If I run ant -diagnostics I always get the output of the java.runtime.version : 1.8.0_292-b10. It does not take JAVA_HOME or any other means of re-configuration into consideration. I understand that it'd be necessary to have a known/ fixed tool chain for builds. But I'd expect that user-vm and system-vm and complex layering concepts sort of work out/ are understandable.

Thus Libreoffice requires JDK 8 AND 11 (at least on my machines). Which makes sense when different parts of the builds require different JDKs. But I'd rather go with a JDK 11 downcompiling to 8 instead of having each for its own target.
Comment 6 onkobu 2021-08-12 21:18:04 UTC
=dev-java/ant-core-1.10.9 – forgot to mention this version.
Comment 7 jospezial 2021-08-13 11:13:11 UTC
First you should start providing us more info about your machine.

emerge --info (followed by the java packages in question)

Also interesting for eselect if you can emerge openjdk versions with gentoo-vm USE flag.
Comment 8 onkobu 2021-08-18 07:36:52 UTC
Created attachment 733791 [details]
emerge --info
Comment 9 onkobu 2021-08-18 08:28:35 UTC
I couldn't find any information about gentoo-vm clearing the fog between me and the (coarse) inner workings. https://wiki.gentoo.org/wiki/Gentoo_Java_USE_flags is pretty useless and https://packages.gentoo.org/useflags/gentoo-vm is too general. Therefore I'm still uncertain whether adding gentoo-vm for openjdk-bin-11* makes the JDK 8 version obsolete/ turns it off (for libreoffice builds).

Answering two questions will help me get along:

1. The USE flag gentoo-vm is totally different from eselect's term system-vm and does not affect eselect-java? Or in other words: USE-flag gentoo-vm enables eselect-java to pickup the emerged JDK while a JDK lacking this flag cannot be selected through eselect-java?

2. Running java -version in a user process uses eselect's JDKs flagged system-vm or user-vm package whereas an ebuild uses gentoo-vm instead? 

Question #2 contradicts question #1 partly and intentionally. An ebuild is able to express a dependency to a certain JDK explicitely. So there ought to be a lookup mechanism for JDKs for ebuilds based on BDEPEND (a JDK, e.g. =openjdk-bin-8.x) and implications for the installed files based on RDEPEND (a different JDK, e.g. >=openjdk-bin-jre-8). It is absolutely valid to build with a lower version JDK and run with a higher version JRE – lets name this assumption Java Bytecode Backward Compatibility (JBBC).

JDK 11 broke JBBC by dropping a lot of features and adding modularization (Jigsaw). This included all kinds of quirks with unmaintained but relevant packages not offering module-info.java. Plus I couldn't find any hints on how BEDEPEND and RDEPEND change JDK lookup. Would help me even further if one could point this out. (Future JDKs are hardening this one, e.g. JDK 14 being the first to fully support multi-release-JARs for jdeps to build working application images.)
Comment 10 jospezial 2021-08-18 13:04:35 UTC
(In reply to onkobu from comment #9)
> I couldn't find any information about gentoo-vm clearing the fog between me
> and the (coarse) inner workings.
> https://wiki.gentoo.org/wiki/Gentoo_Java_USE_flags is pretty useless and
> https://packages.gentoo.org/useflags/gentoo-vm is too general. Therefore I'm
> still uncertain whether adding gentoo-vm for openjdk-bin-11* makes the JDK 8
> version obsolete/ turns it off (for libreoffice builds).
> 
> Answering two questions will help me get along:
> 
> 1. The USE flag gentoo-vm is totally different from eselect's term system-vm
> and does not affect eselect-java? Or in other words: USE-flag gentoo-vm
> enables eselect-java to pickup the emerged JDK while a JDK lacking this flag
> cannot be selected through eselect-java?

Try out
/etc/portage/profile/package.use.mask:dev-java/openjdk-bin:11 -gentoo-vm
/etc/portage/profile/package.use.mask:dev-java/openjdk:11 -gentoo-vm
Then you can eselect it.
eselect java-vm list
Available Java Virtual Machines:
  [1]   openjdk-bin-11  system-vm

joerg@jlgentoo ~ $ eselect java-vm show
Current system-vm
  openjdk-bin-11
Current user-vm
  (unset)

=================================================================
                        Package Settings
=================================================================

virtual/jre-11-r2::gentoo was built with the following:
USE="" ABI_X86="(64)"


virtual/jdk-11-r2::gentoo was built with the following:
USE="-headless-awt" ABI_X86="(64)"


dev-java/openjdk-bin-11.0.11_p9-r1::gentoo was built with the following:
USE="alsa cups gentoo-vm -headless-awt (-selinux) -source" ABI_X86="(64)"
Comment 11 onkobu 2021-08-18 13:20:14 UTC
First of all gentoo-vm is not available for JDK 8 ebuilds. It is only listed for JDK 11. What I tried with flag gentoo-vm:

1. as local USE-variable in combination with emerge, no change
2. as a line in file /etc/portage/package.use/java with no - (to activate it), no change
3. as a line in file /etc/portage/profile/package.use.mask/java

Only the third attempt enabled it:

emerge --pretend --verbose =dev-java/openjdk-bin-11.0.11_p9-r1

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-java/openjdk-bin-11.0.11_p9-r1:11::gentoo  USE="alsa cups gentoo-vm* -headless-awt (-selinux) -source" 0 KiB

Thus I conclude experimental means the USE flag cannot be enabled according to the handbook: https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/USE#Using_USE_flags (which is linked from https://wiki.gentoo.org/wiki/USE_flag.

I'd like to add this somewhere, preferrably https://wiki.gentoo.org/wiki/Gentoo_Java_USE_flags?
Comment 12 Andreas Sturmlechner gentoo-dev 2021-08-18 13:26:07 UTC
This seems to be no longer about libreoffice; unsubscribing.
Comment 13 Andreas Sturmlechner gentoo-dev 2021-08-18 13:43:42 UTC
(In reply to onkobu from comment #5)
> Thus Libreoffice requires JDK 8 AND 11 (at least on my machines). Which
> makes sense when different parts of the builds require different JDKs. But
> I'd rather go with a JDK 11 downcompiling to 8 instead of having each for
> its own target.

Again:

(In reply to Andreas Sturmlechner from comment #1)
> LO does not build with JDK-8 at all. It requires JDK-11.

Also DEPENDing on dev-java/ant-core is no contradiction. dev-java/ant-core's deps ensure that it works.
Comment 14 onkobu 2021-08-18 16:32:21 UTC
After re-emerging openjdk-bin with un-masked gentoo-vm USE flag libreoffice successfully emerges with openjdk-bin-11 (excerpts from build.log):

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info […] --with-ant-home=/usr/share/ant -with-jdk-home=/usr/lib64/openjdk-11
…
checking the installed JDK... found /usr/lib64/openjdk-11 (JDK 11.0.11)
…
x86_64-pc-linux-gnu-gcc -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 […]  -I/usr/lib64/openjdk-11/include -I/usr/lib64/openjdk-11/include/linux -I$S/config_host
…
S=/var/tmp/portage/app-office/libreoffice-7.1.3.2/work/libreoffice-7.1.3.2 && I=$S/instdir && W=$S/workdir &&  cd $W/CustomTarget/jvmfwk/jreproperties/ &&  /usr/lib64/openjdk-11/bin/javac -J-Xmx128M -encoding utf8 --release 8 -Xlint:-options   -d $W/CustomTarget/jvmfwk/jreproperties/ $S/jvmfwk/plugins/sunmajor/pluginlib/JREProperties.java

And Ant reports (filtered many unnecessary properties):

$> ant -diagnostics

[…]
------- Ant diagnostics report -------
Apache Ant(TM) version 1.10.9 compiled on October 19 2020

-------------------------------------------
 Implementation Version
-------------------------------------------
core tasks     : 1.10.9 in file:/usr/share/ant/lib/ant.jar

-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.10.9 compiled on October 19 2020
ant.java.version: 11
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: /usr/share/ant/lib/ant.jar
ant.home: /usr/share/ant

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
[…]

-------------------------------------------
 System properties
-------------------------------------------
java.specification.version : 11
java.vm.vendor : AdoptOpenJDK
java.vm.specification.version : 11
java.home : /opt/openjdk-bin-11.0.11_p9
java.runtime.version : 11.0.11+9
java.vendor.version : AdoptOpenJDK-11.0.11+9
java.version : 11.0.11
java.vendor : AdoptOpenJDK
java.vm.version : 11.0.11+9
java.class.version : 55.0

Libreoffice runs/ is usable. I'm searching for a way to determine which JDK/ JRE is in use. Will re-emerge ant-core to see if it switches to JDK 11, too.
Comment 15 onkobu 2021-08-18 17:16:44 UTC
Found Bug767136, dealing with ant-core only.