4

Is it possible to have glibc and uClibc based applications running side-by-side on one system?

Background: We have binary gcc based cross-compiler configured to link with uClibc. We have cross-compiled glibc with it. Now we want to build some applications so they will link with the glibc rather than uClibc. We don't want to rebuild the compiler.

4

3 回答 3

4

glibc 和 uClibc 并排生活没有问题,一些程序链接到一个程序,而其他程序链接到另一个程序。但是,附加库存在问题。您系统上的每个共享库都将针对 glibc 或 uClibc 构建(使用相应的头文件,它们为标准库函数定义不同的 ABI),例如,如果 glibc 程序和 uClibc 程序都需要 ncurses,则需要构建两个版本的 ncurses,并有办法确保在运行时加载给定程序的正确版本。或者,您可以选择仅使用一组共享库,并将静态库用于链接到另一个 libc 的程序,但您仍然需要构建 2 组库。

于 2010-11-05T16:41:04.650 回答
2

Yes, it should be perfectly possible, but you might have to play around with LD_PRELOAD_PATH. If you are linking statically, change to dynamic linking.

于 2010-11-05T08:01:20.910 回答
0

几乎不可能将它们混合在同一个 FHS 中,因为 ABI 和包含目录不兼容。但是,您可以通过调整 ELF 中的动态链接器字段并利用 gcc/binutils 中的 sysroot 功能将它们中的任何一个安装在目录偏移中。Gentoo 社区[1] 正在进行一项实验,称为 Prefix/libc。

  1. http://wiki.gentoo.org/wiki/Prefix/libc
于 2013-07-01T13:45:29.840 回答