系统环境:CentOS 6.3 64位 httpd-2.4.4
配置Apache:
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd \
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
--with-ssl=/usr/local/openssl/ --enable-so --enable-ssl \
--enable-cgi --enable-rewrite --with-zlib --with-pcre \
--enable-modules=most --enable-mpms-shared='prefork event' --with-mpm=event
# make && make install
报错:
make[4]: Entering directory `/root/shishir/httpd-2.4.1/modules/ssl'
/root/shishir/httpd-2.4.1/srclib/apr/libtool --silent --mode=link gcc -std=gnu99 -g -O2 -pthread -o mod_ssl.la -rpath /usr/pw/apache/modules -module -avoid-version mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_eng
ine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_scache.lo ssl_util_stapling.lo ssl_util.lo ssl_util_ssl.lo ssl_engine_ocsp.lo
ssl_util_ocsp.lo -L/usr/pw/apache/openssl/lib -lssl -lcrypto -lrt -lcrypt -lpthread -export-symbols-regex ssl_module
/usr/bin/ld: /usr/pw/apache/openssl/lib/libssl.a(s3_srvr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/pw/apache/openssl/lib/libssl.a: could not read symbols: Bad value(还不清楚原因 )
collect2: ld returned 1 exit status
make[4]: *** [mod_ssl.la] Error 1
make[4]: Leaving directory `/root/shishir/httpd-2.4.1/modules/ssl'
在Google上查了下资料,如下
The root problem seems to be with your compile of OpenSSL-1.0.1, not Apache.
Per the error message "recompile with -fPIC ", you should add the switch -fPIC to your ./config (or your ./Configure) command when you build OpenSSL. You may also want to add no-gost to this command too.
Position Independent Code is necessary for a module like mod_ssl which may get placed anywhere in memory at runtime. It is not necessary for the standalone OpenSSL test program, which is why make test worked OK without -fPIC.
因镜像中自带的openssl版本过低,但卸载的话会有很多依赖性,所以就直接安装了个稍高的版本,首次配置时直接写的安装路径其他默认,这次配置如下:
./config --prefix=/usr/local/openssl/ -fPIC enable-shared(这个没有启用,默认的)
然后重新编译安装Apache,正常无报错。
阅读(3547) | 评论(0) | 转发(0) |