0

I'm compiling NRPE to deploy on several remote systems. The remote single-board computers run a stripped version of Debian on arm5 architecture. I'd like to avoid installing both OpenSSL and NRPE on all the systems and instead just build a single NRPE binary that includes all the relevant libraries.

I can't find any documented way to configure and make the NRPE binary with static libraries. Am I missing something in the documentation? Or is there some standard set of arguments/options I should use in the compile process to statically link the libraries?

Installation works fine with dynamic OpenSSL libraries.

I'm working on one of the nodes with the intention of compiling the code there and then copying the binary over to the other units.

Steps I've taken:

  • download and compile OpenSSL

  • download, configure and compile NRPE

    • latest release from https://github.com/NagiosEnterprises/nrpe
    • point it to the OpenSSL install (using --with-ssl=DIR --with-ssl-inc=DIR --with-ssl-lib=DIR)
    • if only static openssl libs are available, NRPE's config will fail with the error checking for SSL libraries... configure: error: Cannot find ssl libraries

Edit: I've tried modifying the compile flags by manually editing the src/Makefile. I commented out the default LDFLAGS= and added the absolute paths of the openssl static libs to the OTHERLIBS=.

CC=gcc
CFLAGS=-g -O2 -I/usr/local/include/openssl -DHAVE_CONFIG_H -I
$(CFG_INCLUDE) -I $(SRC_INCLUDE)
#LDFLAGS= -L/usr/local/lib  -lssl -lcrypto -static
LDFLAGS=
SOCKETLIBS= -lnsl
LIBWRAPLIBS=
OTHERLIBS= /usr/local/lib/libcrypto.a /usr/local/lib/libssl.a

This resulted in undefined reference errors when trying to call openssl functions.

make all
cd ./src/; make
make[1]: Entering directory `/root/tmp/nrpe-nrpe-3.2.1/src'
gcc -g -O2 -I/usr/local/include/openssl -DHAVE_CONFIG_H -I ../include -I ./../include -o nrpe ./nrpe.c ./utils.c ./acl.c  -lnsl   /usr/local/lib/libcrypto.a /usr/local/lib/libssl.a
/usr/local/lib/libcrypto.a(threads_pthread.o): In function `fork_once_func':
...
/usr/local/lib/libssl.a(t1_enc.o): In function `tls1_change_cipher_state':
t1_enc.c:(.text+0x2e4): undefined reference to `COMP_CTX_free'
t1_enc.c:(.text+0x2fc): undefined reference to `COMP_CTX_new'
t1_enc.c:(.text+0x3bc): undefined reference to `COMP_CTX_free'
t1_enc.c:(.text+0x3d4): undefined reference to `COMP_CTX_new'
collect2: ld returned 1 exit status
make[1]: *** [nrpe] Error 1
make[1]: Leaving directory `/root/tmp/nrpe-nrpe-3.2.1/src'
make: *** [all] Error 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.