Skip to content

Commit 058a829

Browse files
authored
Merge pull request oracle#13 from jerboaa/mandrel-no-jlinking-backport
Fix build with --no-jlinking
2 parents 7ff5518 + 583e1d7 commit 058a829

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

sdk/mx.sdk/mx_sdk_vm_impl.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,13 +2180,9 @@ def _get_extra_jvm_args():
21802180
extra_jvm_args = mx.list_to_cmd_line(image_config.extra_jvm_args)
21812181
if not _jlink_libraries():
21822182
if mx.is_windows():
2183-
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"',
2184-
r'--add-modules org.graalvm.polyglot',
2185-
r'--module-path "%location%\..\..\truffle\truffle-api.jar:%location%\..\..\jvmci\polyglot.jar"'])
2183+
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"'])
21862184
else:
2187-
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"',
2188-
'--add-modules org.graalvm.polyglot',
2189-
'--module-path "${location}/../../truffle/truffle-api.jar:${location}/../../jvmci/polyglot.jar"'])
2185+
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"'])
21902186
return extra_jvm_args
21912187

21922188
def _get_option_vars():

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,12 @@ public List<String> getBuilderJavaArgs() {
561561
*/
562562
public List<Path> getBuilderModulePath() {
563563
List<Path> result = new ArrayList<>();
564-
// Non-jlinked JDKs need truffle and graal-sdk on the module path since they
565-
// don't have those modules as part of the JDK.
564+
// Non-jlinked JDKs need truffle and word, collections, nativeimage on the
565+
// module path since they don't have those modules as part of the JDK. Note
566+
// that graal-sdk is now obsolete after the split in GR-43819 (#7171)
566567
if (libJvmciDir != null) {
567-
result.addAll(getJars(libJvmciDir, "graal-sdk", "enterprise-graal"));
568+
result.addAll(getJars(libJvmciDir, "enterprise-graal"));
569+
result.addAll(getJars(libJvmciDir, "word", "collections", "nativeimage"));
568570
}
569571
if (modulePathBuild) {
570572
result.addAll(createTruffleBuilderModulePath());
@@ -574,19 +576,37 @@ public List<Path> getBuilderModulePath() {
574576
}
575577

576578
private List<Path> createTruffleBuilderModulePath() {
577-
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise");
579+
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle"));
580+
List<Path> jars = getJars(libTruffleDir, "truffle-api", "truffle-runtime", "truffle-enterprise");
578581
if (!jars.isEmpty()) {
579582
/*
580583
* If Truffle is installed as part of the JDK we always add the builder modules of
581584
* Truffle to the builder module path. This is legacy support and should in the
582585
* future no longer be needed.
583586
*/
584-
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
587+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
585588
Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder"));
586589
if (Files.exists(builderPath)) {
587-
jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm"));
590+
List<Path> truffleRuntimeSVMJars = getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm");
591+
jars.addAll(truffleRuntimeSVMJars);
592+
if (libJvmciDir != null && !truffleRuntimeSVMJars.isEmpty()) {
593+
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
594+
// JDKs
595+
jars.addAll(getJars(libJvmciDir, "polyglot"));
596+
}
597+
}
598+
if (libJvmciDir != null) {
599+
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
600+
jars.addAll(getJars(libTruffleDir, "jniutils"));
588601
}
589602
}
603+
/*
604+
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
605+
* image builder still needs it
606+
*/
607+
if (libJvmciDir != null) {
608+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
609+
}
590610

591611
return jars;
592612
}

0 commit comments

Comments
 (0)