diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index 46cf946a543d..63a3eee22172 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -108,6 +108,10 @@ public class SubstrateOptions { if (!Platform.includedIn(Platform.LINUX.class)) { throw UserError.invalidOptionValue(key, key.getValue(), "Building static executable images is currently only supported on Linux. Remove the '--static' option or build on a Linux machine"); } + if (!LibCBase.targetLibCIs(MuslLibC.class)) { + throw UserError.invalidOptionValue(key, key.getValue(), + "Building static executable images is only supported with musl libc. Remove the '--static' option or add the '--libc=musl' option."); + } }); @APIOption(name = "libc")// diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ValidateImageBuildOptionsFeature.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ValidateImageBuildOptionsFeature.java index b7fea207a8ce..c20c7d1b8041 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ValidateImageBuildOptionsFeature.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ValidateImageBuildOptionsFeature.java @@ -25,15 +25,16 @@ package com.oracle.svm.core.option; import org.graalvm.collections.UnmodifiableMapCursor; -import jdk.graal.compiler.options.OptionKey; -import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; +import com.oracle.svm.core.feature.InternalFeature; + +import jdk.graal.compiler.options.OptionKey; @AutomaticallyRegisteredFeature public class ValidateImageBuildOptionsFeature implements InternalFeature { @Override - public void afterRegistration(AfterRegistrationAccess access) { + public void beforeAnalysis(BeforeAnalysisAccess access) { UnmodifiableMapCursor, Object> cursor = RuntimeOptionValues.singleton().getMap().getEntries(); while (cursor.advance()) { validate(cursor.getKey());