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

GR-47186 "Fix native-image --add-modules" breaks --no-jlinking builds #7085

Closed
zakkak opened this issue Jul 31, 2023 · 1 comment · Fixed by #7205
Closed

GR-47186 "Fix native-image --add-modules" breaks --no-jlinking builds #7085

zakkak opened this issue Jul 31, 2023 · 1 comment · Fixed by #7205

Comments

@zakkak
Copy link
Collaborator

zakkak commented Jul 31, 2023

Describe the issue
#7076 breaks builds with --no-jlinking (which includes Mandrel builds graalvm#554).

Building with --no-jlinking results in the following error:

Exception in thread "main" java.lang.IllegalArgumentException: Missing scheme
	at java.base/java.nio.file.Path.of(Path.java:200)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.callListModules(NativeImage.java:1616)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.listModulesFromPath(NativeImage.java:1585)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.buildImage(NativeImage.java:1449)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:1196)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1772)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1737)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1711)
Exception in thread "main" java.lang.IllegalArgumentException: Missing scheme
	at java.base/java.nio.file.Path.of(Path.java:200)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.callListModules(NativeImage.java:1616)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.listModulesFromPath(NativeImage.java:1585)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.buildImage(NativeImage.java:1449)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:1196)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1772)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1737)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1711)

Further inspection reveals that this happens because when using the --no-jlinking option the --list-modules command fails with:

$ /home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/bin/java -p /home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/jvmci/graal-sdk.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/truffle/truffle-api.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/truffle/truffle-compiler.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/truffle/truffle-runtime.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/svm/builder/svm.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/svm/builder/objectfile.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/svm/builder/pointsto.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/svm/builder/native-image-base.jar:/home/zakkak/code/graal/sdk/mxbuild/linux-amd64/GRAALVM_73636D9934_JAVA21_STAGE1/graalvm-73636d9934-java21-23.1.0-dev/lib/svm/library-support.jar --list-modules

Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.graalvm.jniutils not found, required by org.graalvm.nativeimage.builder

Steps to reproduce the issue

 mx --primary-suite-path substratevm --no-jlinking --components="Native Image,LibGraal" --native-images=native-image,lib:jvmcicompiler build

Describe GraalVM and your environment:

  • GraalVM version: 70b50a8
  • JDK major version: 21-jvmci-23.1-b10
  • OS: Fedora 38
  • Architecture: AMD64

cc @olpaw

@zakkak zakkak changed the title GR-47186 Fix native-image --add-modules breaks --no-jlinking builds GR-47186 "Fix native-image --add-modules" breaks --no-jlinking builds Jul 31, 2023
@olpaw olpaw self-assigned this Jul 31, 2023
@jerboaa
Copy link
Collaborator

jerboaa commented Aug 11, 2023

This currently fails for me with (after #7171):

Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.graalvm.polyglot not found

Building native-image.image: Failed due to error: 1

because of the --add-modules org.graalvm.polyglot directive in the bash script.

If I change that to --add-modules ALL-DEFAULT then the error becomes:

Error: Determining image-builder observable modules failed (Exit status 1). Process output: 
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module org.graalvm.nativeimage.base does not read a module that exports org.graalvm.compiler.options

or with --verbose:

$ native-image --verbose --macro:native-image-launcher
Apply jar:file:///disk/graal/upstream-sources/graal/sdk/mxbuild/linux-amd64/GRAALVM_F701446458_JAVA17_STAGE1/graalvm-f701446458-java17-23.1.0-dev/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/polyglot/native-image.properties
Apply jar:file:///disk/graal/upstream-sources/graal/sdk/mxbuild/linux-amd64/GRAALVM_F701446458_JAVA17_STAGE1/graalvm-f701446458-java17-23.1.0-dev/lib/svm/library-support.jar!/META-INF/native-image/com.oracle.svm/thirdparty/native-image.properties
Error: Determining image-builder observable modules failed (Exit status 1). Process output: 
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module org.graalvm.nativeimage.base does not read a module that exports org.graalvm.compiler.options
com.oracle.svm.driver.NativeImage$NativeImageError: Determining image-builder observable modules failed (Exit status 1). Process output: 
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module org.graalvm.nativeimage.base does not read a module that exports org.graalvm.compiler.options
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.showError(NativeImage.java:2221)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.callListModules(NativeImage.java:1654)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.listModulesFromPath(NativeImage.java:1627)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.buildImage(NativeImage.java:1491)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.completeImageBuild(NativeImage.java:1238)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1813)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1778)
	at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1752)

The reason for this is that --list-modules with the module path, but without --upgrade-module-path <path/to/graal.jar is being used. I hope to have a fix proposed for this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants