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?
Create a statically linked application The -I option tells GCC to search for header files listed after it. In this case, you're specifying the current directory, represented by a single dot ( . ). Link mathDemo.o with libmymath. a to create the final executable.
Static linking is the result of the linker copying all library routines used in the program into the executable image. This may require more disk space and memory than dynamic linking, but is both faster and more portable, since it does not require the presence of the library on the system where it is run.
The main difference between static and dynamic linking is that static linking copies all library modules used in the program into the final executable file at the final step of the compilation while, in dynamic linking, the linking occurs at run time when both executable files and libraries are placed in the memory.
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.
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
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