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

jdk17 libjvm link failure with --as-needed and clock_gettime in librt

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b19
    • CPU:
      generic
    • OS:
      linux

      Description

      The fix from JDK-8246112 breaks the build with old (but according to comments still supported) glibc versions, when ld defaults to the --as-needed behavior.

      The reason for that is the passing of a library (-lrt) in a LDFLAGS macro, not in a LIBS macro.

      A quick workaround is

      --- a/make/autoconf/flags-ldflags.m4
      +++ b/make/autoconf/flags-ldflags.m4
      @@ -113,7 +113,7 @@
             # But once our supported minimum build and runtime platform
             # has glibc 2.17, this can be removed as the functions are
             # in libc.
      - OS_LDFLAGS_JVM_ONLY="-lrt"
      + OS_LDFLAGS_JVM_ONLY="-Wl,--no-as-needed -lrt"
           fi
         fi

      So -lrt should be passed in the macros which are used to pass -ldl -lpthread ...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dholmes David Holmes
              Reporter:
              doko Matthias Klose
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: