Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345744

Use C++ LINK_TYPE with SetupBuildLauncher in StaticLibs.gmk

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • None
    • infrastructure
    • None
    • b02

      The static launcher (built with 'make static-jdk-image') is statically linked with libstdc++. We need to set LINK_TYPE to C++ with SetupBuildLauncher in StaticLibs.gmk, so LDCXX is used for linking the static launcher executable. Otherwise, LD is used. In some build environments, that causes failure to static linking libstdc++.

      I notice both -static-libstdc++ and -l:libstdc++.a are specified in the linking command for the static launcher on linux. Only one needs to be specified to direct the linker to statically link libstdc++. It appears that -static-libstdc++ is more commonly used. As a usage example, I run into 'ld: error: unable to find library -l:libstdc++.a' failure when building the static launcher. Removing -l:libstdc++.a mitigates the linking issue.

            jiangli Jiangli Zhou
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: