Skip to content

[GR-41675] libmanagement_ext.a unconditionally being added when libawt_headless.a is linked in #5119

@jerboaa

Description

@jerboaa

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

  1. git clone --branch imageio-management-ext https://github.com/jerboaa/mandrel-integration-tests.git
  2. cd mandrel-integration-tests
  3. export JAVA_HOME=/path/to/graalvm; export GRAALVM_HOME=$JAVA_HOME; export PATH=$JAVA_HOME/bin:$PATH
  4. mvn 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions