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

Bug 878299

Summary: app-emulation/virtualbox-7.0.2: add support for Java 11
Product: Gentoo Linux Reporter: Viorel Munteanu <ceamac>
Component: Current packagesAssignee: Viorel Munteanu <ceamac>
Status: UNCONFIRMED ---    
Severity: normal CC: gentoo, kripton, kroemmelbein, Martin.Jansa
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=832166
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: java errors with openjdk-bin-11
setting VBOX_JAVAC_OPTS=110000 and >=virtual/jre-9 to build with openjdk:25

Description Viorel Munteanu gentoo-dev 2022-10-25 17:56:34 UTC
Currently support for java is pinned to java 8 because in 11 they removed wsimport.  Need to add to the tree a package that provides wsimport and add it as BDEPEND.

See also https://bugs.gentoo.org/832166

The error still exists in virtualbox-7.0.2
Comment 1 Volkmar W. Pogatzki 2022-10-27 07:59:53 UTC
(In reply to Viorel from comment #0)
> Currently support for java is pinned to java 8 because in 11 they removed
> wsimport.  Need to add to the tree a package that provides wsimport and add
> it as BDEPEND.
> [...]

If you need help when packaging those dependencies ping me on #gentoo-java in libera.chat
Comment 2 Larry the Git Cow gentoo-dev 2024-07-26 15:02:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a11f1f4701706742d6114104cbf4da827714026f

commit a11f1f4701706742d6114104cbf4da827714026f
Author:     Viorel Munteanu <ceamac@gentoo.org>
AuthorDate: 2024-07-26 14:36:43 +0000
Commit:     Viorel Munteanu <ceamac@gentoo.org>
CommitDate: 2024-07-26 14:58:47 +0000

    app-emulation/virtualbox: add 7.1.0_beta1
    
    This is a beta version, add unkeyworded.
    Branch 7.1 uses QT6.
    
    Cannot build the docs because:
    - this uses https://github.com/dita-ot/dita-ot (not yet packaged) to
      build the docs
    - dita-ot needs java 17
    - java 17 lacks wsimport and virtualbox does not compile without it, and
      I wouldn't want to require both java 1.8 and java 17.
    For now mask the doc USE flag.
    
    If built with certain CFLAGS, does not start (xpcom errors).
    Do not respect user CFLAGS until I figure out a fix.
    
    Python 3.12 and python 3.13 still crash.
    
    Bug: https://bugs.gentoo.org/878299
    Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>

 app-emulation/virtualbox/Manifest                  |   3 +-
 .../virtualbox/virtualbox-7.1.0_beta1.ebuild       | 732 +++++++++++++++++++++
 2 files changed, 734 insertions(+), 1 deletion(-)
Comment 3 Volkmar W. Pogatzki 2024-07-27 06:51:59 UTC
(In reply to Volkmar W. Pogatzki from comment #1)
> > [...]
> 
> If you need help when packaging those dependencies ping me on #gentoo-java
> in libera.chat

Or try the pre-compiled jar from https://repo1.maven.org/maven2/com/sun/xml/ws/jaxws-tools/4.0.2/
Comment 4 Viorel Munteanu gentoo-dev 2024-07-27 06:55:52 UTC
I will try that, thanks.
Comment 5 Viorel Munteanu gentoo-dev 2024-09-15 10:47:14 UTC
Small update here.

After installing dev-java/jaxws-ri-bin (not in tree) and dev-java/jaxws-api and after adding all needed jars to classpath, I get compile errors.

So we're still stuck at java 1.8.

I'll attach the log and I'll open an issue upstream.
Comment 6 Viorel Munteanu gentoo-dev 2024-09-15 10:49:17 UTC
Created attachment 903042 [details]
java errors with openjdk-bin-11
Comment 7 Volkmar W. Pogatzki 2024-09-15 11:21:23 UTC
(In reply to Viorel Munteanu from comment #5)
> Small update here.
> 
> After installing dev-java/jaxws-ri-bin (not in tree) and dev-java/jaxws-api
> and after adding all needed jars to classpath, I get compile errors.
> 
> So we're still stuck at java 1.8.
> 
> I'll attach the log and I'll open an issue upstream.

i'd like to see the ebuild. what branch is it? needs not be a PR.
Comment 8 Viorel Munteanu gentoo-dev 2024-09-15 11:26:32 UTC
I kind of hacked the Makefile by hand, but I can create a PR later and I'll ping you when done.
Comment 9 Volkmar W. Pogatzki 2024-09-15 11:28:19 UTC
(In reply to Viorel Munteanu from comment #8)
> I kind of hacked the Makefile by hand, but I can create a PR later and I'll
> ping you when done.


what is the build system here which triggers javac with '-source 9 -target 9'?
is it aware of "$(java-pkg_get-source)" and "$(java-pkg_get-target)"?
Comment 10 Viorel Munteanu gentoo-dev 2024-09-15 11:33:22 UTC
It's a Makefile:

if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 110000                                                                
 VBOX_JAVAC_OPTS   = -encoding UTF-8 -source 9 -target 9 -Xlint:unchecked                                                      
else if defined(VBOX_JAVA_VERSION) && $(VBOX_JAVA_VERSION) >= 90000                                                            
 VBOX_JAVAC_OPTS   = -encoding UTF-8 -source 6 -target 6 -Xlint:unchecked                                                      
else                                                                                                                           
 VBOX_JAVAC_OPTS   = -encoding UTF-8 -source 1.5 -target 1.5 -Xlint:unchecked                                                  
endif                                                                                                                          

I'll try to replace this with what you said, maybe it works.  Thanks!
Comment 11 Volkmar W. Pogatzki 2024-09-16 06:48:23 UTC
Their logic is clear:
Java 11 dropped support for 1.5 [1]
Java 17 dropped support for 1.6
Java 21 dropped support for 1.7
Java 21 still supports 1.8 and throws warnings it might be dropped in a future version

Best i guess, would be to set VBOX_JAVAC_OPTS with "$(java-pkg_get-source)" and "$(java-pkg_get-target)" regardless what VBOX_JAVA_VERSION and put >=virtual/jre-1.8:* and >=virtual/jre-1.8:*

In Gentoo we set -source and -target to the lowest version which is supported by the openjdk versions in the tree.

Another idea: Patch that Makefile to not trigger javac and compare what I did in https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1ddc1263008cc3a468688c1c166e9867d789d3f

[1]https://marc.info/?l=gentoo-dev&m=161838633318104&w=2
Comment 12 Volkmar W. Pogatzki 2024-12-31 22:04:32 UTC
Created attachment 915618 [details, diff]
setting VBOX_JAVAC_OPTS=110000 and >=virtual/jre-9 to build with openjdk:25

I've played with the 7.0.20 ebuild and it seems to build even with openjdk:25 (which presently is still waiting to get merged).

In order to build with higher Java versions, VBOX_JAVAC_OPTS needs to be set so that '-source 9 -target 9' is selected.
And '>=virtual/jre-9' seems needed. (what is does can be displayed by putting einfo "Target is $(java-pkg_get-target)" somewhere in the ebuild)
Comment 13 Volkmar W. Pogatzki 2025-01-01 06:37:33 UTC
Problem is that if built with '-target 9' it would not run on systems with only Java 8.

If there was a VBOX_JAVAC_OPTS option with '-source 8 -target 8' we could try going with '>=virtual/jre-1.8' and '>=virtual/jdk-1.8'.