编译PHP失败导致libpcre

我正在尝试自己编译PHP,因为我想使用PHPBrew在多个版本的PHP之间切换.

我已经在这个过程中解决了很多问题,但是对于这个问题,我无法进一步解决.我在make过程中收到此错误消息:

/usr/bin/ld: /usr/libpcre.a(pcre_exec.o): relocation R_X86_64_32S against `_pcre_ucd_stage1' can not be used when making a shared object; recompile with -fPIC
/usr/libpcre.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libPHP5.5.5.la] Fehler 1
Error

我需要从/usr/libpcre.a添加一个符号链接 – > /usr/lib/x86_64-linux-gnu/libpcre.a之前,否则他会抱怨找不到libpcre.a.

我还尝试添加“EXTRACFLAGS = -fPIC”来制作,但它不会改变任何东西.这是我第一次编译某些东西,所以我甚至不确定我是否掌握了正确的基础知识.

这是在Ubuntu 13.10下(在12.04没有看到相同的问题).这是我的PHPBrew命令:

PHPbrew install 5.5.5 +default+MysqL+pdo+apxs2

这将导致生成以下配置选项:

./configure ‘–prefix=/home/malte/.PHPbrew/PHP/PHP-5.5.5’
‘–with-config-file-path=/home/malte/.PHPbrew/PHP/PHP-5.5.5/etc’
‘–with-config-file-scan-dir=/home/malte/.PHPbrew/PHP/PHP-5.5.5/var/db’ ‘–with-pear=/home/malte/.PHPbrew/PHP/PHP-5.5.5/lib/PHP
‘–disable-all’ ‘–enable-phar’ ‘–enable-session’
‘–enable-short-tags’ ‘–enable-tokenizer’ ‘–with-pcre-regex’
‘–with-zlib=/usr’ ‘–with-libdir=lib/i386-linux-gnu’
‘–with-MysqL=MysqLnd’ ‘–with-MysqLi=MysqLnd’
‘–with-pdo-MysqL=MysqLnd’ ‘–enable-pdo’
‘–with-apxs2=/usr/bin/apxs2’ ‘–enable-dom’ ‘–enable-libxml’
‘–enable-simplexml’ ‘–enable-xml’ ‘–enable-xmlreader’
‘–enable-xmlwriter’ ‘–with-xsl’ ‘–with-libxml-dir=/usr’
‘–enable-bcmath’ ‘–with-bz2=/usr’ ‘–enable-calendar’ ‘–enable-cli’
‘–enable-ctype’ ‘–enable-dom’ ‘–enable-fileinfo’ ‘–enable-filter’
‘–enable-shmop’ ‘–enable-sysvsem’ ‘–enable-sysvshm’
‘–enable-sysvmsg’ ‘–enable-json’ ‘–enable-mbregex’
‘–enable-mbstring’ ‘–with-mhash’ ‘–with-mcrypt=/usr’
‘–enable-pcntl’ ‘–with-pcre-regex=/usr’ ‘–with-pcre-dir=/usr’
‘–enable-phar’ ‘–enable-posix’ ‘–with-readline=/usr’
‘–enable-sockets’ ‘–enable-tokenizer’ ‘–enable-zip’ 2>&1 >
/home/malte/.PHPbrew/build/PHP-5.5.5/build.log

我想我已经安装了所有相关的软件包:

dpkg --get-selections | grep pcre
libpcre++0:amd64                install
libpcre3:amd64                  install
libpcre3:i386                   install
libpcre3-dev:amd64              install
libpcrecpp0:amd64               install

任何帮助真的很感激!

解决方法:

您需要使用与位置无关的代码重建libpcre.直接的方法是构建或安装使用-fPIC构建的libpcre共享对象(例如libpcre.so).

由于库存档位于/usr/lib / x86_64-linux-gnu中,因此共享对象也可能存在.尝试将-L /usr/lib / x86_64-linux-gnu添加PHP的LDFLAGS.这也将使您免于符号链接到/ usr.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...