I want to compile a program and statically link it to glibc, so it can run on other Linux distributions without the user having to do any special configuration.

I tried using CFLAGS="-static -static-libgcc", but it statically links against all other libraries required, except glibc. I tried searching the apt repositories for a static version of glibc, but I couldn't find any.

I am using the default gcc installed with Ubuntu.

How can I get a static library version of glibc on Ubuntu 18.04?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.