操作系统:centos6.4 X86_64
apache版本:httpd-2.2.6
openssl版本:openssl-1.0.1e
源码编译apache时报如下错误:
ssl_engine_init.c: In function 'ssl_init_ctx_protocol':ssl_engine_init.c:390: warning: assignment discards qualifiers from pointer target typessl_engine_init.c:396: warning: assignment discards qualifiers from pointer target typessl_engine_init.c: In function 'ssl_init_ctx_verify':ssl_engine_init.c:546: error: 'STACK' undeclared (first use in this function)ssl_engine_init.c:546: error: (Each undeclared identifier is reported only oncessl_engine_init.c:546: error: for each function it appears in.)ssl_engine_init.c:546: error: expected expression before ')' tokenssl_engine_init.c: In function 'ssl_init_FindCAList':ssl_engine_init.c:1126: warning: pointer type mismatch in conditional expressionmake[4]: *** [ssl_engine_init.slo] 错误 1make[4]: Leaving directory `/software/httpd-2.2.6/modules/ssl'make[3]: *** [shared-build-recursive] 错误 1make[3]: Leaving directory `/software/httpd-2.2.6/modules/ssl'make[2]: *** [shared-build-recursive] 错误 1make[2]: Leaving directory `/software/httpd-2.2.6/modules'make[1]: *** [shared-build-recursive] 错误 1make[1]: Leaving directory `/software/httpd-2.2.6'make: *** [all-recursive] 错误 1
原因分析:apache2.x 和openssl1.0.x不兼容导致的
解决方法:安装openssl0.9.8e
安装步骤:
# tar zxvf openssl-0.9.8e.tar.gz# cd openssl-0.9.8e# ./config shared zlib# make # make test# make install# mv /usr/bin/openssl /usr/bin/openssl.OFF# mv /usr/include/openssl /usr/include/openssl.OFF# rm -rf /usr/lib/libssl.so# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl# ln -s /usr/local/ssl/include/openssl /usr/include/openssl# ln -sv /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
配置库文件搜索路径
# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf# ldconfig -v
检测安装结果
# openssl version
OpenSSL 0.9.8e 23 Feb 2007
安装成功!
重新编译apache,编译时参数加上 --enable-ssl --with-ssl=/usr/local/ssl
问题解决。