In Linux, downloaded a program source and want it to be statically linked. Have a huge Makefile there, I
./configure make
to compile. prehpes it's a bit too general to ask, but how can I make the binary statically linked?
EDIT: the reason for this is wanting to make sure the binary will have no dependencies (or at least as few as possible), making it possible to run on any Linux based computer, even one without Internet connection, and non-updated Linux.
Most autoconf
generated configure
script will allow you to make a static build:
./configure --enable-static make
If that doesn't work, you may be able to pass linker flags in via LDFLAGS
, like this:
./configure LDFLAGS=-static
Yeah, you need to edit the make file and add the -static parameter to gcc during the link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With