Glibc 和 uClibc 在一个系统上并行运行

发布于 2024-09-30 17:16:10 字数 203 浏览 2 评论 0原文

是否可以在一个系统上并行运行基于 glibcuClibc 的应用程序?

背景:我们有基于二进制 gcc 的交叉编译器,配置为与 uClibc 链接。我们用它交叉编译了 glibc。现在我们想要构建一些应用程序,以便它们与 glibc 而不是 uClibc 链接。我们不想重建编译器。

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.

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

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

发布评论

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

评论(3

吖咩 2024-10-07 17:16:10

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

There's no problem with glibc and uClibc living side-by-side with some programs linking to one and other programs linking to the other. However, there is a problem with additional libraries. Each shared library on your system will be built against either glibc or uClibc (using the corresponding headers, which define distinct ABIs for the standard library functions), so for example if both a glibc program and a uClibc program need ncurses, you'll need to have two versions of ncurses built, and have a way of ensuring that the correct one for the given program gets loaded at runtime. Alternatively, you could choose to only use one set of shared libraries, and use static libraries for programs linked to the other libc, but you'd still need to build your 2 sets of libraries.

请爱~陌生人 2024-10-07 17:16:10

是的,这应该是完全可能的,但是您可能必须使用 LD_PRELOAD_PATH。如果您是静态链接,请更改为动态链接。

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.

暗恋未遂 2024-10-07 17:16:10

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

  1. http://wiki.gentoo.org/wiki/Prefix/libc

It is nearly impossible to mix them in the same FHS, as the ABI and include dir are incompatible. However, you could install either of them in an directory offset, by tweaking dynamic-linker field in ELF and exploiting sysroot feature in gcc/binutils. An on going experiment is in Gentoo community[1], known as Prefix/libc.

  1. http://wiki.gentoo.org/wiki/Prefix/libc
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文