Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too heavyweight org.graalvm.shadowed.icu4j #8889

Closed
JaroslavTulach opened this issue May 8, 2024 · 4 comments · Fixed by #8908
Closed

Too heavyweight org.graalvm.shadowed.icu4j #8889

JaroslavTulach opened this issue May 8, 2024 · 4 comments · Fixed by #8908
Assignees
Labels

Comments

@JaroslavTulach
Copy link
Contributor

Describe GraalVM and your environment :

  • GraalVM version or commit id if built from source: 21.0.2+13.1
  • CE or EE: CE
  • JDK version: JDK21.0.2
  • OS and OS Version: Ubuntu
  • Architecture: amd64
  • The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM (21.0.2+13-jvmci-23.1-b30) for linux-amd64 JRE (21.0.2+13-jvmci-23.1-b30),
built on 2024-01-06T13:12:14Z by "buildslave" with gcc 11.2.0

Have you verified this issue still happens when using the latest snapshot?

Confirmed by a discussion on slack

Describe the issue

I am trying to find a minimal JDK to execute Enso programming language and environment on, I am using jlink. I am trying to get things down as much as I can, but Graal.js seems to need java.desktop! (via a transitive dependency thru regex):

java.lang.module.FindException: Module java.desktop not found, required by org.graalvm.shadowed.icu4j
$ rm ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/component/icu4j-24.0.0.jar 
java.lang.module.FindException: Module org.graalvm.shadowed.icu4j not found, required by com.oracle.truffle.regex
$ rm ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/component/regex-24.0.0.jar 
java.lang.module.FindException: Module com.oracle.truffle.regex not found, required by org.graalvm.js

E.g. org.graalvm.js needs com.oracle.truffle.regex and that one needs org.graalvm.shadowed.icu4j and that one needs java.desktop.

I assume the java.desktop dependency isn't necessary - maybe it can be made optional... can such a change be made in your build?

Steps to reproduce the issue

I am generating the minimal JDK as:

$ /graalvm/bin/jlink --output jdk --add-modules java.net.http,jdk.unsupported,java.sql,jdk.management,jdk.jfr
$ ./jdk/bin/java --list-modules
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

and then I'd like to invoke Graal.js and its components on the generated JVM. It fails with java.lang.module.FindException as shown above.

Expected behavior

java.desktop is a huge module and it shouldn't be needed for running Graal.js - having that fixed would allow using Graal.js & co. in headless JDKs without java.desktop & co. modules.

Additional context

I have discovered this problem while working on:

@medoussboug medoussboug self-assigned this May 8, 2024
@woess woess self-assigned this May 8, 2024
@woess
Copy link
Member

woess commented May 8, 2024

I assume the java.desktop dependency isn't necessary - maybe it can be made optional... can such a change be made in your build?

A quick investigation shows it is only needed for one method in ICU4J: Bidi.setPara(AttributedCharacterIterator) (due to java.awt.font.TextAttribute and java.awt.font.NumericShaper), which I believe we don't use anywhere.
So I think we could easily make the dependency on java.desktop optional (using requires static, or if that does not work for some reason, patch out the method).

Do you need this to be backported to 23.1.x, or is it enough to do this for 24.1 only?

@woess
Copy link
Member

woess commented May 10, 2024

Suggested fix: #8908. Let me know if you want to test this before merging @JaroslavTulach.

@JaroslavTulach
Copy link
Contributor Author

Hello Andreas. Thanks for the #8908 fix, it looks good.

A quick investigation shows it is only needed for one method in ICU4J: Bidi.setPara(AttributedCharacterIterator) (due to java.awt.font.TextAttribute and java.awt.font.NumericShaper), which I believe we don't use anywhere. So I think we could easily make the dependency on java.desktop optional (using requires static, or if that does not work for some reason, patch out the method).

Yup, requires static in suite.py seems like the right fix.

Do you need this to be backported to 23.1.x, or is it enough to do this for 24.1 only?

We are trying to stay with the latest Truffle (but LTS JDK - e.g. 21), so having the fix in latest Truffle release is good enough for Enso.

@woess
Copy link
Member

woess commented May 13, 2024

ok, so I assume this does not need to be backported, since you can use the latest version on LTS JDK. good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants