mod_ssl.so: undefined symbol: SSL_get_srp_userinfo

2017年8月4日 | 分类: 【技术】

如果需要支持http2,就要求高于OpenSSL的版本高于1.0.1,也就只能编译安装OpenSSL,然后编译安装Apache。

目前最新版是Apache 2.4.27 (2017-07-11)。

wget http://www-us.apache.org/dist//httpd/httpd-2.4.27.tar.gz && tar -zxvf httpd-2.4.27.tar.gz && cd httpd-2.4.27
export CPPFLAGS="-I/usr/include/openssl" LDFLAGS="-L/usr/lib"
./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --with-crypto --enable-rewrite --enable-headers --enable-deflate --enable-socache-shmcb --enable-negotiation  --enable-ssl --with-ssl=/usr/lib --enable-http2 --with-nghttp2=/usr/local/lib --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install

重点在于设置 CPPFLAGS 和 LDFLAGS 。

如果没有设置或者没有正确设置,会报错:

Cannot load module mod_ssl.so: undefined symbol: SSL_get_srp_userinfo"

参考:https://serverfault.com/questions/587267/upgrade-to-apache-2-4-9-opensssl-error-ssl-get-srp-userinfo
参考:https://superuser.com/questions/912599/apache-error-after-upgrade-cannot-load-module-mod-ssl-so-undefined-symbol-ssl
参考:http://www.linuxquestions.org/questions/linux-server-73/upgrading-apache-to-2-4-9-openssl-error-ssl_get_srp_userinfo-4175500874-print/
参考:http://blog.sina.com.cn/s/blog_78d3277d0102x5l0.html

注意:在重新编译之前,需要清空已编译的文件:

make distclean

参考 configure 的帮助文件:

输入:

./configure --help

输出:

...
Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor