GNU_LIBC_VERSION 和 GNU_NPTL_VERSION 有什么区别?

发布于 2024-07-10 05:09:25 字数 622 浏览 4 评论 0原文

请注意这两个 RedHat Linux 系统配置设置:

$ getconf GNU_LIBC_VERSION
glibc 2.3.4

$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4

我看到它们对应于一些 TLS 库:

/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

我想链接这些库而不是 /usr/lib 等效项。 我有几个问题:

  1. 我在 RedHat 和 Debian 上看到过这个。 所有 GNU Linux 发行版上都存在它吗?
  2. 是否存在 GNU_LIBC_VERSIONGNU_LIBPTHREAD_VERSION 不同的情况?
  3. 这些变量可安全用于识别 /lib/tls 中的共享库吗? 我想在 Makefile 中自动执行此操作,而不是硬编码神奇的 glibc/pthread 版本号。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜嗑 2024-07-17 05:09:26

首先在 Linux 上实现 pThreads 的 NPTL 项目是一个单独的项目,最初添加了内核支持并提供其自己的图书馆。

当它足够稳定时,它被合并到 glibc 中。 我假设这两个版本在所有合理的最新安装上都是相同的。

在 Ubuntu 8.10 上,输出如下:

$ getconf GNU_LIBC_VERSION
glibc 2.8.90
$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.8.90

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文