-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[GR-48144] Fix native-image build with --no-jlinking #7205
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -561,10 +561,12 @@ public List<String> getBuilderJavaArgs() { | |
*/ | ||
public List<Path> getBuilderModulePath() { | ||
List<Path> result = new ArrayList<>(); | ||
// Non-jlinked JDKs need truffle and graal-sdk on the module path since they | ||
// don't have those modules as part of the JDK. | ||
// Non-jlinked JDKs need truffle and word, collections, nativeimage on the | ||
// module path since they don't have those modules as part of the JDK. Note | ||
// that graal-sdk is now obsolete after the split in GR-43819 (#7171) | ||
if (libJvmciDir != null) { | ||
result.addAll(getJars(libJvmciDir, "graal-sdk", "enterprise-graal")); | ||
result.addAll(getJars(libJvmciDir, "enterprise-graal")); | ||
result.addAll(getJars(libJvmciDir, "word", "collections", "nativeimage")); | ||
jerboaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
if (modulePathBuild) { | ||
result.addAll(createTruffleBuilderModulePath()); | ||
|
@@ -574,19 +576,37 @@ public List<Path> getBuilderModulePath() { | |
} | ||
|
||
private List<Path> createTruffleBuilderModulePath() { | ||
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise"); | ||
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle")); | ||
List<Path> jars = getJars(libTruffleDir, "truffle-api", "truffle-runtime", "truffle-enterprise"); | ||
if (!jars.isEmpty()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch should never be triggered >= 23.1. This is only here to support builds where truffle is still living in a GraalVM JDK. How come this triggers for you? What component configuration are you using? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chumer these changes were introduced by me in zakkak@85088b1 As I explain in #7205 (review) (back then) these changes allowed me to build GraalVM CE with
Looking at the CE configuration that was used while testing the above I see more components being included which probably explains the need for these changes back then: https://github.com/zakkak/mandrel/blob/85088b19f8062246d5f0a95c83ace120ee034c25/vm/mx.vm/ce#L2 As @jerboaa said we are more than happy to drop these if they are no longer relevant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't (usually) trigger for us. I think this code is pre-existing and we wanted to make sure we don't break anything when this path is being used. This code seems to account for the fact that certain (modular) jar files have dependencies. If this path is taken and a
Does that sound OK? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jerboaa @zakkak Your CE env config explains why this still triggers for you. As you know, we have gone unchained and many of your CE env configuration components are about to be removed on master. I'd recommend switching to a config similar to this: https://github.com/oracle/graal/blob/master/vm/mx.vm/ce#L2
You should never need to put Ultimately @olpaw is in charge of this code and needs to decide what goes in and what not. I do not know enough about --no-jlinking to judge whether these changes are justified. I know that many of your changes probably stem from an outdated/wrong environment config, and I think these changes will mostly no longer be necessary after you update the env. @olpaw should decide whether it is fine to merge this as an intermediate step top unblock you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your input. So the the comment inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jerboaa your PR is already in our merge queue. Feel free to provide a cleanup PR after this one got merged that reduces the changes needed for your usecase to a minimum. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, thank you. Will do that, then. |
||
/* | ||
* If Truffle is installed as part of the JDK we always add the builder modules of | ||
* Truffle to the builder module path. This is legacy support and should in the | ||
* future no longer be needed. | ||
*/ | ||
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler")); | ||
jars.addAll(getJars(libTruffleDir, "truffle-compiler")); | ||
Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder")); | ||
if (Files.exists(builderPath)) { | ||
jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm")); | ||
List<Path> truffleRuntimeSVMJars = getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm"); | ||
jars.addAll(truffleRuntimeSVMJars); | ||
if (libJvmciDir != null && !truffleRuntimeSVMJars.isEmpty()) { | ||
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked | ||
// JDKs | ||
jars.addAll(getJars(libJvmciDir, "polyglot")); | ||
jerboaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
if (libJvmciDir != null) { | ||
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs | ||
jars.addAll(getJars(libTruffleDir, "jniutils")); | ||
} | ||
} | ||
/* | ||
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native | ||
* image builder still needs it | ||
*/ | ||
if (libJvmciDir != null) { | ||
jars.addAll(getJars(libTruffleDir, "truffle-compiler")); | ||
} | ||
|
||
return jars; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.