升级glibc - 如果没有分发补丁,它如何运作

时间:2015-05-23 08:30:34

标签: c linux gcc glibc

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

我想从源代码安装glibc 2.21。 (我意识到我们距离Fedora 22版本还有很长的路要走,但这个问题将在下次我有兴趣安装更新版本的glibc时使用。)

在2.21源上运行configure说:

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

它参考了glibc faq,然后说:

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文件。

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

所有这些补丁都是RedHat / Fedora存储库"人员"已经取消了。 (我假设这些特定于发行版的补丁很重要......)如此多的地方说升级glibc通常是安全的吗?

就此而言,如果许多分发包具有这样的分发定制,那么从源代码构建任何东西的工作方式如何?我已经运行gcc和gdb的主干源版本很长一段时间了,偶尔会遇到颠簸,因为它不会发布代码,但它通常有效...我不知道那些现在工作,或者没有分发存储库补丁。

1 个答案:

答案 0 :(得分:0)

升级Glibc并不安全。因为许多程序都与当前版本的glibc相关联,升级CAN会破坏它们。除非您从发行版中应用补丁。但我再也不建议这样做。 但是,如果您编译静态程序,或者例如使用bash脚本更改LD_LIBRARY_PATH,则可以使用另一个glibc。

bash中的

LD_LIBRARY_PATH=path/to/new/lib program

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

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