【问题标题】:Error when compiling PHP with openssl: recompile with -fPIC使用 openssl 编译 PHP 时出错:使用 -fPIC 重新编译
【发布时间】: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


【解决方案1】:

如果你的系统是64bit,当你编译openssl时,'-m64'会被添加到编译标志,只要打开opensslMakefile,去掉所有'-m64',然后

make & make install

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

【讨论】:

    猜你喜欢
    • 2013-08-25
    • 2018-05-14
    • 2016-09-12
    • 1970-01-01
    • 1970-01-01
    • 2017-10-24
    • 2012-11-28
    • 1970-01-01
    相关资源
    最近更新 更多