使用openssl编译PHP时出错:使用-fPIC重新编译

时间:2014-11-20 14:18:58

标签: php linux configuration compilation openssl

我使用以下命令编译了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。

1 个答案:

答案 0 :(得分:1)

如果您的系统为64bit,则在汇编openssl时,“-m64”会添加到编译标记中,只需打开Makefile openssl ,删除所有“-m64”,然后

make & make install

然后回到php源目录,make就可以了!