今天在合作方的服务器上编译nrpe时,报如下错误
- cd ./src/; make ; cd ..
- make[1]: Entering directory `/usr/local/src/nrpe-2.12/src'
- gcc -g -O2 -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include -DHAVE_CONFIG_H -o nrpe nrpe.c utils.c -L/usr/lib64 -lssl -lcrypto -lnsl -lwrap
- nrpe.c: In function ‘main’:
- nrpe.c:244: warning: assignment makes pointer from integer without a cast
- /tmp/cccgDIQ0.o: In function `main':
- /usr/local/src/nrpe-2.12/src/nrpe.c:244: undefined reference to `get_dh512'
- collect2: ld returned 1 exit status
- make[1]: *** [nrpe] Error 1
- make[1]: Leaving directory `/usr/local/src/nrpe-2.12/src'
- *** Compile finished ***
- If the NRPE daemon and client compiled without any errors, you
- can continue with the installation or upgrade process.
- Read the PDF documentation (NRPE.pdf) for information on the next
- steps you should take to complete the installation or upgrade.
其中的错误为
- /usr/local/src/nrpe-2.12/src/nrpe.c:244: undefined reference to `get_dh512'
这个错误是由openssl引起的,我发现系统上除了默认的openssl外在/usr/local/ssl目录下有个编译的openssl,这个也可以从以上错误输出看出来:gcc -g -O2 -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include -DHAVE_CONFIG_H -o nrpe nrpe.c utils.c -L/usr/lib64 -lssl -lcrypto -lnsl -lwrap
- -I/usr/local/ssl
看来是没有去找系统默认的openssl和openssl-devel解决方法:
我是直接去configure文件里把/usr/local/ssl这个路径给删了
- vi /usr/local/src/nrpe-2.12/configure
- for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl
- # 把这行中的/usr/local/ssl去掉
- for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl
生成makefile
- ./configure
- make all
通过,OK。