Static linking with a custom glibc version

Florian Weimer fweimer@redhat.com
Wed Jun 3 12:22:03 GMT 2020


* Mahmood Naderan via Libc-help:

> Now, I want to build a static binary, but the following command are not correct
> $ gcc -o test -Wl,--emit-relocs -l/opt/glibc-2.23-install/lib/ld-2.23.so test.o
> or
> $ gcc -o test -Wl,--emit-relocs \ 
>       -Wl,--rpath=/opt/glibc-2.23-install \
>       -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so \
>       -Wl,-Bstatic test.o
>
> Any way to fix that? 

A statically linked binary needs to be linked with libc.a (among other
things).

Thanks,
Florian



More information about the Libc-help mailing list