今天在合作方的服务器上编译nrpe时,报如下错误

 
  
  1. cd ./src/; make ; cd ..  
  2. make[1]: Entering directory `/usr/local/src/nrpe-2.12/src'  
  3. 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   
  4. nrpe.c: In function ‘main’:  
  5. nrpe.c:244: warning: assignment makes pointer from integer without a cast  
  6. /tmp/cccgDIQ0.o: In function `main':  
  7. /usr/local/src/nrpe-2.12/src/nrpe.c:244: undefined reference to `get_dh512'  
  8. collect2: ld returned 1 exit status  
  9. make[1]: *** [nrpe] Error 1  
  10. make[1]: Leaving directory `/usr/local/src/nrpe-2.12/src'   
  11.  
  12. *** Compile finished ***  
  13.  
  14. If the NRPE daemon and client compiled without any errors, you  
  15. can continue with the installation or upgrade process.  
  16.  
  17. Read the PDF documentation (NRPE.pdf) for information on the next  
  18. steps you should take to complete the installation or upgrade. 

其中的错误为

 
  
  1. /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

 
  
  1. -I/usr/local/ssl 

看来是没有去找系统默认的openssl和openssl-devel解决方法:

我是直接去configure文件里把/usr/local/ssl这个路径给删了

 
  
  1. vi /usr/local/src/nrpe-2.12/configure  
  2. 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  
  3. # 把这行中的/usr/local/ssl去掉  
  4. 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

 
  
  1. ./configure  
  2. make all 

通过,OK。