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?
Try this:
./configure LDFLAGS="-static"
For people coming from google, I found that if you have libtool
part of your build, you will need to:
./configure CFLAGS="-static" ....
make LDFLAGS="-all-static"
You can see that -all-static
with libtool --help --mode=link
来源:https://stackoverflow.com/questions/20068947/how-to-static-link-linux-software-that-uses-configure