Can You Statically Link Glibc?

Can You Statically Link Glibc?

Most of the sources online state that you can statically link glibc, but discourage from doing so; e.g. centos package repo: The glibc-static package contains the C library static libraries for -static linking. You don't need these, unless you link statically, which is highly discouraged.

Is glibc dynamically linked?

Applications built with the glibc toolchain will by dynamically linked by default. Application that load shared libraries at runtime using dlopen() must link with the libdl library ( -ldl ).

Can you statically link a dynamic library?

You can't statically link a shared library (or dynamically link a static one).

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.