Link glibc statically but some other library dynamically with GCC
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.