The -static
option links a program statically, in other words it does not require a dependency on dynamic libraries at runtime in order to run.
To achieve static linking requires that the archive (.a
) versions of your libraries exist on the system. so /usr/lib/libc.a
, /usr/lib/crt1.o
, etc.
On modern linux systems (as you are using red hat): when a binary links together it 1) either puts the code into the executable via .o
and .a
files, or 2) puts in references to dynamic libraries (.so
) files that is resolved by /lib/ld-linux.so
(or /lib64/ld-linux=x86-64.so
) which is always at a well known place.
For your particular system, if a program is specifically looking to create a static version of itself then you need to install the static versions of your devel tools. You need, at the minimum, glibc-static
package. You may also need libstdc++-static
package as well.