Skip to content

Commit

Permalink
Report error if building static executable without musl libc
Browse files Browse the repository at this point in the history
  • Loading branch information
pejovica committed Feb 6, 2024
1 parent 0b083e6 commit bad3314
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<OptionKey<?>, Object> cursor = RuntimeOptionValues.singleton().getMap().getEntries();
while (cursor.advance()) {
validate(cursor.getKey());
Expand Down

0 comments on commit bad3314

Please sign in to comment.