gpt4 book ai didi

c - 升级 glibc - 它如何在没有发行版补丁的情况下工作

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:28:53 24 4
gpt4 key购买 nike

Fedora 21 存储库有 glibc-2.20-8.fc21

我想从源代码安装 glibc 2.21。 (我意识到我们距离 Fedora 22 发布还有几天的时间,但是下次我有兴趣安装更新版本的 glibc 时,这个问题将适用。)

在 2.21 源上运行配置说:

On GNU/Linux systems the GNU C Library should not be installed into
/usr/local since this might make your system totally unusable.

它引用查看 glibc 常见问题解答,然后说:

The GNU C compiler treats /usr/local/include and /usr/local/lib in a special
way, these directories will be searched before the system directories. Since
on GNU/Linux the system directories /usr/include and /usr/lib contain a ---
possibly different --- version of glibc and mixing certain files from
different glibc installations is not supported and will break, you risk
breaking your complete system. If you want to test a glibc installation, use
another directory as argument to --prefix. If you like to install this glibc
version as default version, overriding the existing one, use --prefix=/usr
and everything will go in the right places.

我正在考虑我想走哪条路(/usr/local 以外的单独目录,或者覆盖/usr)。

但是,我注意到某处说如果你要这样做,你要确保使用与你的 Linux 发行版相同的配置选项。

所以,我下载了 glibc-2.20-8.fc21.src.rpm 并解压了它。这是我第一次看到 linux 发行版对上游代码做了什么。有 48 个 .patch 文件、3 个额外的 .c 文件、一个额外的 .h 文件和一些 .conf 文件。

无论您是使用第二个(非/usr/local)位置还是覆盖/usr,从源代码安装 glibc 是否安全(如果是,如何)?

RedHat/Fedora 存储库“人们”制作的所有补丁都将被跳过。 (我认为这些特定于发行版的补丁很重要...)为什么有这么多地方说升级 glibc 通常是安全的?

就此而言,如果许多分发包都具有这种数量的分发定制,那么从源代码构建任何东西又如何工作呢?很长一段时间以来,我一直在运行 gcc 和 gdb 的主干源代码构建,偶尔会遇到问题,因为它不是发布代码,但它通常可以工作......我现在也不知道它们是如何工作的,没有分发存储库补丁。

最佳答案

升级 Glibc 并不安全。因为您的许多程序都链接到当前版本的 glibc 并且升级可以破坏它们。除非你从你的发行版应用补丁。但我再次不推荐这样做。但是,如果您静态编译程序,或者例如在您要运行该应用程序时使用 bash 脚本更改 LD_LIBRARY_PATH,则可以使用另一个 glibc。

在庆典中:

LD_LIBRARY_PATH=path/to/new/lib program

最好的方法是使用您当前的 Eloquent 来制作任何程序。

感谢@rubenvb 帮我解决了问题。

关于c - 升级 glibc - 它如何在没有发行版补丁的情况下工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30410599/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com