如何关联 glibc 和“libc”版本?
我的 Linux 机器上的 realpath
手册页显示:
VERSIONS
On Linux this function appeared in libc 4.5.21.
现在这是什么意思?它指的是哪个 libc - “Linux libc”? - 我在哪里可以找到匹配不同 libc 风格的列表,以便我可以了解链接到此函数和其他函数的最低要求是什么?
GLIBC 的版本为 2.13,远低于 4.5.21,但有关 glibc 的维基百科页面显示:
在 20 世纪 90 年代初,开发者 Linux 内核分叉了 glibc。他们的 fork,称为“Linux libc”,是 单独维护多年,并且 已发布版本 2 至 5。
...以及
最后使用的 Linux libc 版本 使用内部名称(soname) libc.so.5。继此之后, Linux 上的 glibc 2.x 使用 soname libc.so.6
这是否意味着任何 glibc 都相当于主版本高于 5 的“Linux libc”?
还有其他手册页引用了这个或那个版本的“libc”,因此 realpath 只是整个问题的一个示例。
注意:我正在构建的代码不限于Linux,这就是为什么我需要一个明确的方法来检测某个功能是否可用。
The man page for realpath
on my Linux box says:
VERSIONS
On Linux this function appeared in libc 4.5.21.
Now what does that mean? To which libc is it referring - "Linux libc"? - and where can I find a list that matches up the different libc flavors, so I can see what the minimum requirements are to link to this function and others?
GLIBC is at version 2.13, which is considerably lower than 4.5.21, but the Wikipedia page about glibc says:
In the early 1990s, the developers of
the Linux kernel forked glibc. Their
fork, called "Linux libc", was
maintained separately for years and
released versions 2 through 5.
... and
The last used version of Linux libc
used the internal name (soname)
libc.so.5. Following on from this,
glibc 2.x on Linux uses the soname
libc.so.6
Does that imply that any glibc is equivalent to a "Linux libc" with a major version higher than 5?
There are other man pages referencing this or that version of "libc", so realpath
is merely one example for problem at large.
Note: the code I am building is not limited to Linux, that's why I need a definite method to detect whether a certain function is available.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
glibc 尽管版本为 2.x,但多年来一直被称为“libc6”,以与旧的 libc3/4/5 的版本控制方案兼容。无论如何,Linux 系统上的手册页非常有帮助,但不一定是规范的。 glibc 使用“信息”系统而不是手册页,因此对于 glibc 函数,您最好查看 glibc 手册 比手册页。虽然 realpath 函数上的 bug 类别在历史背景下很有趣,但除非您的目标是 libc5 系统(当然不是),否则并不是特别有帮助。
glibc, although at version 2.x, was for many years referred to as "libc6" for compatibility with the versioning scheme of the old libc3/4/5. In any case, the man pages on a Linux system are very helpful, but not necessarily canonical. glibc uses the "info" system instead of man pages, thus for glibc functions, you may be better off looking at the glibc manual than the man pages. While the bugs category on the realpath function is interesting in a historical context, unless you're targeting libc5 systems (which, surely you're not) is not particularly helpful.