操作系统: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 type ssl_engine_init.c:396: warning: assignment discards qualifiers from pointer target type ssl_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 once ssl_engine_init.c:546: error: for each function it appears in.) ssl_engine_init.c:546: error: expected expression before ')' token ssl_engine_init.c: In function 'ssl_init_FindCAList': ssl_engine_init.c:1126: warning: pointer type mismatch in conditional expression make[4]: *** [ssl_engine_init.slo] 错误 1 make[4]: Leaving directory `/software/httpd-2.2.6/modules/ssl' make[3]: *** [shared-build-recursive] 错误 1 make[3]: Leaving directory `/software/httpd-2.2.6/modules/ssl' make[2]: *** [shared-build-recursive] 错误 1 make[2]: Leaving directory `/software/httpd-2.2.6/modules' make[1]: *** [shared-build-recursive] 错误 1 make[1]: Leaving directory `/software/httpd-2.2.6' make: *** [all-recursive] 错误 1
原因分析:apache2.x 和openssl1.0.x不兼容导致的
解决方法:安装openssl0.9.8e
安装步骤:
1
2
3
4
5
6
7
8
9
10
11
12
|
# 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 |
配置库文件搜索路径
1
2
|
# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf # ldconfig -v |
检测安装结果
1
|
# openssl version |
OpenSSL 0.9.8e 23 Feb 2007
安装成功!
重新编译apache,编译时参数加上 --enable-ssl --with-ssl=/usr/local/ssl
问题解决。
本文转自月魔zhi蕾51CTO博客,原文链接: http://blog.51cto.com/308107405/1537541,如需转载请自行联系原作者