【发布时间】:2015-01-18 10:40:03
【问题描述】:
我确实使用以下命令编译了 openssl:
./config --prefix=/usr/local --openssldir=/usr/local/openssl -fPIC
make
make test
make install
所以,当我尝试编译 php 时,出现以下错误:
/usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against `BZ2_crc32Table' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libbz2.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: ** [libphp5.la] Erro 1
This error occours when I running the command for to configure the PHP:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-libdir=/usr/lib/x86_64-linux-gnu --with-openssl --with-openssl-dir=/usr/bin --with-mysql --with-mysqli --enable-mbstring --with-mcrypt=/usr/lib/libmcrypt.so --with-pdo-mysql --enable-opcache --enable-soap --enable-sockets --with-zlib --with-bz2=/usr/local/bzip2 --with-zlib --with-curl && make clean && make && make install && service apache2 restart
就像我在编译 openssl 时需要使用 -fPIC 参数一样,我相信问题与 openssl 有关。
我正在使用 Debian。
【问题讨论】:
-
'config' 是否直接接受 fpic 参数? fpic 是一个 gcc 标志。如果 config 没有将它传递给 gcc,那么你就没有在 PIC 模式下编译。
-
@MarcB 怎么知道?
-
libbz2.a 和 bzlib.o 不是 openssl 库。尝试编译 PHP 时尝试替换 -fPIC。
标签: php linux configuration compilation openssl