apache安装报错undefined reference ssl                        


因为SSL发现漏洞,需要更换openssl-1.0.1g版本,编译安装后,apache httpd2.4.9提示还是旧版本的SSL,于是重新编译安装apache httpd,configure没有报错,但make的时候报如下错误:


/software/httpd-2.4.9/support/ab.c:735: undefined reference to `SSL_write'
ab.o: In function `ssl_proceed_handshake':
/software/httpd-2.4.9/support/ab.c:650: undefined reference to `SSL_do_handshake'
/software/httpd-2.4.9/support/ab.c:651: undefined reference to `SSL_get_error'
ab.o: In function `ssl_print_info':
/software/httpd-2.4.9/support/ab.c:623: undefined reference to `SSL_get_peer_cert_chain'
/software/httpd-2.4.9/support/ab.c:631: undefined reference to `SSL_get_peer_certificate'
ab.o: In function `ssl_print_connection_info':
/software/httpd-2.4.9/support/ab.c:572: undefined reference to `SSL_get_version'
/software/httpd-2.4.9/support/ab.c:574: undefined reference to `SSL_get_current_cipher'
/software/httpd-2.4.9/support/ab.c:575: undefined reference to `SSL_CIPHER_get_version'
/software/httpd-2.4.9/support/ab.c:576: undefined reference to `SSL_CIPHER_get_name'
/software/httpd-2.4.9/support/ab.c:578: undefined reference to `SSL_CIPHER_get_bits'
ab.o: In function `ssl_print_info':
/software/httpd-2.4.9/support/ab.c:640: undefined reference to `SSL_get_session'
/software/httpd-2.4.9/support/ab.c:640: undefined reference to `SSL_SESSION_print'
ab.o: In function `ssl_proceed_handshake':
/software/httpd-2.4.9/support/ab.c:662: undefined reference to `SSL_get_current_cipher'
/software/httpd-2.4.9/support/ab.c:663: undefined reference to `SSL_CIPHER_get_bits'
/software/httpd-2.4.9/support/ab.c:664: undefined reference to `SSL_get_peer_certificate'
/software/httpd-2.4.9/support/ab.c:671: undefined reference to `SSL_CIPHER_get_name'
/software/httpd-2.4.9/support/ab.c:671: undefined reference to `SSL_get_version'
ab.o: In function `start_connect':
/software/httpd-2.4.9/support/ab.c:1278: undefined reference to `SSL_new'
/software/httpd-2.4.9/support/ab.c:1286: undefined reference to `SSL_set_bio'
/software/httpd-2.4.9/support/ab.c:1287: undefined reference to `SSL_set_connect_state'
ab.o: In function `close_connection':
/software/httpd-2.4.9/support/ab.c:1369: undefined reference to `SSL_shutdown'
/software/httpd-2.4.9/support/ab.c:1370: undefined reference to `SSL_free'
ab.o: In function `read_connection':
/software/httpd-2.4.9/support/ab.c:1395: undefined reference to `SSL_read'
/software/httpd-2.4.9/support/ab.c:1397: undefined reference to `SSL_get_error'
ab.o: In function `test':
/software/httpd-2.4.9/support/ab.c:1810: undefined reference to `SSL_state'
ab.o: In function `ssl_state_cb':
/software/httpd-2.4.9/support/ab.c:511: undefined reference to `SSL_state_string_long'
/software/httpd-2.4.9/support/ab.c:511: undefined reference to `SSL_state'
/software/httpd-2.4.9/support/ab.c:506: undefined reference to `SSL_alert_desc_string_long'
/software/httpd-2.4.9/support/ab.c:506: undefined reference to `SSL_alert_type_string_long'
/software/httpd-2.4.9/support/ab.c:515: undefined reference to `SSL_state_string_long'
ab.o: In function `main':
/software/httpd-2.4.9/support/ab.c:2092: undefined reference to `SSLv23_client_method'
/software/httpd-2.4.9/support/ab.c:2367: undefined reference to `SSL_load_error_strings'
/software/httpd-2.4.9/support/ab.c:2368: undefined reference to `SSL_library_init'
/software/httpd-2.4.9/support/ab.c:2372: undefined reference to `SSL_CTX_new'
/software/httpd-2.4.9/support/ab.c:2377: undefined reference to `SSL_CTX_ctrl'
/software/httpd-2.4.9/support/ab.c:2380: undefined reference to `SSL_CTX_ctrl'
/software/httpd-2.4.9/support/ab.c:2383: undefined reference to `SSL_CTX_set_cipher_list'
/software/httpd-2.4.9/support/ab.c:2308: undefined reference to `SSLv2_client_method'
/software/httpd-2.4.9/support/ab.c:2305: undefined reference to `SSLv23_client_method'
/software/httpd-2.4.9/support/ab.c:2390: undefined reference to `SSL_CTX_set_info_callback'
/software/httpd-2.4.9/support/ab.c:2314: undefined reference to `TLSv1_1_client_method'
/software/httpd-2.4.9/support/ab.c:2311: undefined reference to `SSLv3_client_method'
/software/httpd-2.4.9/support/ab.c:2316: undefined reference to `TLSv1_2_client_method'
/software/httpd-2.4.9/support/ab.c:2319: undefined reference to `TLSv1_client_method'
collect2: ld returned 1 exit status
make[2]: *** [ab] 错误 1
make[2]: Leaving directory `/software/httpd-2.4.9/support'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/software/httpd-2.4.9/support'
make: *** [all-recursive] 错误 1


检查发现是configure的时候没有添加--with-ssl=/usr/local/openssl-1.0.1g(重新编译安装后openssl的路径)的路径,添加后可解决以上报错的问题。


./configure --prefix=/home/apache-249  --enable-ssl --with-ssl=/usr/local/openssl-1.0.1g --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so  --enable-rewrite --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event


如果不使用ssl,也可以在编译时候去掉--enable-ssl --with-ssl=/usr/local/openssl-1.0.1g,加上--disable-ssl 。