Glibc and uClibc side by side on one system
Asked Answered
L

3

5

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.

Lasala answered 5/11, 2010 at 7:57 Comment(0)
G
5

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.

Gowan answered 5/11, 2010 at 16:41 Comment(2)
The problem is that even simple "hello world" application compiled with uClibc based GCC and linked with glibc segfaults. We had to build whole toolchain to get "hello world" working.Lasala
Yes, having to build the whole toolchain is to be expected.Turley
M
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.

Maquis answered 5/11, 2010 at 8:1 Comment(0)
U
0

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
Uniflorous answered 1/7, 2013 at 13:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.