I need to statically link glibc to my project, because the target platform supports only a very old one ( but it works with statically linked glibc from my toolchain, I have
There is a -static-libgcc
if that may help
You should be using -static
, not -Wl,-static
. The latter bypasses gcc's knowledge, and therefore gcc is still trying to link the shared libgcc_s.so
rather than the static libgcc_eh.a
.
If your aim is to link libc statically but libpthread dynamically, this is simply not going to work. You cannot mix and match different versions of libpthread; it's part of glibc, just a separate file, and the internals need to match. Even with the same version, I think linking libc statically and libpthread dynamically will be very broken.
If glibc is too big for your needs, you could try an alternate libc like uClibc or musl.