Search code examples
redhatsslnptl

What's the difference between GNU_LIBC_VERSION and GNU_NPTL_VERSION?


Notice these two RedHat Linux system configuration settings:

$ getconf GNU_LIBC_VERSION
glibc 2.3.4

$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4

I see they correspond to some of the TLS libraries:

/lib/tls/libc-2.3.4.so
/lib/tls/libm-2.3.4.so
/lib/tls/libpthread-2.3.4.so
/lib/tls/librt-2.3.4.so

I'd like to link against these libraries instead of the /usr/lib equivalents. I have a few questions:

  1. I've seen this on RedHat and Debian. Does it exist on all GNU Linux distributions?
  2. Is there any case where GNU_LIBC_VERSION differs from GNU_LIBPTHREAD_VERSION?
  3. Are those variables safe to use for identifying the shared libraries in /lib/tls? I'd like to automate this in a Makefile, rather than hard-coding a magic glibc/pthread version number.

Solution

  • The NPTL project which first implemented pThreads on Linux was a separate project initially adding kernel support and providing its own library.

    When it was stable enough it was merged into glibc. I would assume that those two versions are identical on all reasonably up-to-date installations.

    On Ubuntu 8.10 the output is like this:

    $ getconf GNU_LIBC_VERSION
    glibc 2.8.90
    $ getconf GNU_LIBPTHREAD_VERSION
    NPTL 2.8.90