How to static link Linux software that uses ./configure?

Sandra Schlichting picture Sandra Schlichting · Nov 19, 2013 · Viewed 31.8k times · Source

I would like to compile NRPE static, so I can copy the compiled binary to an OmniOS server, where I don't want gcc to be installed on. I would prefer to install NRPE with SSl support from a repository, but such doesn't seam to exist, so I would like to compile it myself. However the ./configure script doesn't contain a static option it seams

~/nrpe-2.15# ./configure --help | grep static
~/nrpe-2.15# ./configure --help | grep share
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]

Question

How do I compile a program that uses configure statically?

Answer

ams picture ams · Nov 19, 2013

Try this:

./configure LDFLAGS="-static"