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

Mandrel for JDK 21: native-image --enable-preview fails #658

Closed
leahneukirchen opened this issue Jan 13, 2024 · 3 comments · Fixed by graalvm/mandrel-packaging#391
Closed
Assignees
Labels

Comments

@leahneukirchen
Copy link

Description

The JDK 21 included in Graal 23 has support for --enable-preview, but native-image lacks the "preview modules" to use them.

How To Reproduce

Steps to reproduce the behavior:

% pwd
/tmp/mandrel-java21-23.1.1.0-Final

% cat Foo.java
void main() {
  System.out.println("yay");
}

% ./bin/javac --enable-preview --release 21 Foo.java
Note: Foo.java uses preview features of Java SE 21.
Note: Recompile with -Xlint:preview for details.

% ./bin/java --enable-preview Foo           
yay

% ./bin/native-image --enable-preview Foo           
Error: The directory containing the preview modules was not found.

Configuration:

  • OS: Void Linux
  • Architecture: x86_64
  • Mandrel version: 23.1.1.0; official Mandrel binaries
  • JDK version: openjdk 21.0.1 2023-10-17 LTS; official Mandrel binaries

Expected behavior

I expect the program to be compiled into a native image and then behave as if the JVM ran it.

Additional context

A svm-preview directory seems to be lacking, but I'm not sure where it could come from.

With graalvm-community-openjdk-21.0.1+12.1 this works.

@leahneukirchen leahneukirchen added the bug Something isn't working label Jan 13, 2024
@jerboaa
Copy link
Collaborator

jerboaa commented Jan 15, 2024

Thanks for the report. We'll look into it.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 15, 2024

Confirmed. The mandrel build seems to be missing the svm-foreign.jar:

GraalVM Community for JDK 21

$ ls graalvm-community-openjdk-21+35.1/lib/svm-preview/builder/
svm-foreign.jar

Mandrel for JDK 21:

$ ls mandrel-java21-23.1.0.0-Final/lib/svm-preview/builder
ls: cannot access 'mandrel-java21-23.1.0.0-Final/lib/svm-preview/builder': No such file or directory

Removing the svm-preview folder from the GraalVM community distro results in the same error as reported.

We'll fix it for the January release (23.1.2.0-Final).

@jerboaa jerboaa added this to the 23.1.2.0-Final milestone Jan 15, 2024
@jerboaa jerboaa changed the title How to build native-images when using preview features? Mandrel for JDK 21: native-image --enable-preview fails Jan 15, 2024
@jerboaa jerboaa self-assigned this Jan 15, 2024
@jerboaa jerboaa linked a pull request Jan 15, 2024 that will close this issue
@jerboaa
Copy link
Collaborator

jerboaa commented Jan 15, 2024

Fix has been merged. I'll close this now. Please re-open if the release later this month won't have this fixed.

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