-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Describe the issue
For an application, which doesn't use class com.sun.management.internal.OperatingSystemImpl, but does use ImageIO classes for example via libawt_headless, then libmanagement_ext.a static library ends up getting linked into the image no matter what.
Steps to reproduce the issue
git clone --branch imageio-management-ext https://github.com/jerboaa/mandrel-integration-tests.gitcd mandrel-integration-testsexport JAVA_HOME=/path/to/graalvm; export GRAALVM_HOME=$JAVA_HOME; export PATH=$JAVA_HOME/bin:$PATHmvn clean verify -Dquarkus.version=2.12.3.Final -Ptestsuite -Dtest=AppReproducersTest#imageioAWTTest
Describe GraalVM and your environment:
- GraalVM version: built from source, revision 59c0c26
- JDK major version: 17
- OS: Linux
- Architecture: AMD64
More details
This code seems to add libmanagement_ext.a irrespective of it actually needed:
@Override
public void afterAnalysis(AfterAnalysisAccess access) {
if (NativeLibrarySupport.singleton().isPreregisteredBuiltinLibrary("awt_headless")) {
/*
* Ensure that `management_ext` comes before `awt_headless` on the linker command line.
* This is necessary to prevent linker errors such as JDK-8264047.
*/
nativeLibraries.addStaticNonJniLibrary("management_ext", "awt_headless");
}
}
Originally found here: Karm/mandrel-integration-tests#117