dongyu5104
dongyu5104
2015-12-14 16:52

编译PHP7错误

已采纳

I just wanted to build PHP7 from Scratch.

I used this command:

cd php-7.0.0

./configure --prefix=/usr/local/php/7.0.0 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap=shared,/usr --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm  --sysconfdir=/etc/php7/ --with-xpm-dir=/usr --enable-intl --with-ldap --enable-mysqlnd --with-pear=/usr/local/php/7.0.0/pear --with-apxs2 --enable-dtrace --disable-phpdbg --enable-zend-signals

make clean

make

But it breaks with the the Error Message:

/bin/sh /usr/src/php7/php-7.0.0/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/imap/ -I/usr/src/php7/php-7.0.0/ext/imap/ -DPHP_ATOM_INC -I/usr/src/php7/php-7.0.0/include -I/usr/src/php7/php-7.0.0/main -I/usr/src/php7/php-7.0.0 -I/usr/src/php7/php-7.0.0/ext/date/lib -I/usr/include/libxml2 -I/usr/X11 -I/usr/include/freetype2 -I/usr/include/c-client -I/usr/src/php7/php-7.0.0/ext/mbstring/oniguruma -I/usr/src/php7/php-7.0.0/ext/mbstring/libmbfl -I/usr/src/php7/php-7.0.0/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/usr/src/php7/php-7.0.0/ext/sqlite3/libsqlite -I/usr/src/php7/php-7.0.0/ext/zip/lib -I/usr/src/php7/php-7.0.0/TSRM -I/usr/src/php7/php-7.0.0/Zend    -I/usr/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS    -c /usr/src/php7/php-7.0.0/ext/imap/php_imap.c -o ext/imap/php_imap.lo
/bin/sh /usr/src/php7/php-7.0.0/libtool --silent --preserve-dup-deps --mode=link cc -DPHP_ATOM_INC -I/usr/src/php7/php-7.0.0/include -I/usr/src/php7/php-7.0.0/main -I/usr/src/php7/php-7.0.0 -I/usr/src/php7/php-7.0.0/ext/date/lib -I/usr/include/libxml2 -I/usr/X11 -I/usr/include/freetype2 -I/usr/include/c-client -I/usr/src/php7/php-7.0.0/ext/mbstring/oniguruma -I/usr/src/php7/php-7.0.0/ext/mbstring/libmbfl -I/usr/src/php7/php-7.0.0/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/usr/src/php7/php-7.0.0/ext/sqlite3/libsqlite -I/usr/src/php7/php-7.0.0/ext/zip/lib -I/usr/src/php7/php-7.0.0/TSRM -I/usr/src/php7/php-7.0.0/Zend    -I/usr/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS    -o ext/imap/imap.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/src/php7/php-7.0.0/modules -avoid-version -module -L/usr/lib/x86_64-linux-gnu/mit-krb5 -L/usr/lib/x86_64-linux-gnu ext/imap/php_imap.lo -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lc-client -lcrypt -lpam -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libc-client.a(osdep.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/libc-client.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1027: recipe for target 'ext/imap/imap.la' failed
make: *** [ext/imap/imap.la] Error 1

Check a lot of things already. I also linked the x86 Version of the c-client. But nothing helped so far. I also set the CXFLAG -fPIC butt that didn't solved it either

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • dongpu1879 dongpu1879 5年前

    I found the Problem behind the compiling issue.

    First of all, who stumbles about this problem linked the libc-client.a class for x86_64 systems:

    ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

    remove this link This is causing the issue.

    set the lib directory in the configure command correct:

    --with-libdir=/lib/

    then you can compile with apxs2

    This helped for me, at last

    :)

    点赞 评论 复制链接分享
  • douweida2669 douweida2669 5年前

    If you have an "libc-client.a: error adding symbols: Bad value" message under Debian 8 - it can means that you symlinked as advice of @Chris West. But in Debian 8 amd64 /usr/lib/libc-client.a - it is not suitable library to build imap extension. Package version of this library (php5-imap) depends from libc-client2007e package that contains libc-client.so.2007e.0 - this is what you need. Just type:

    ln -s /usr/lib/libc-client.so.2007e.0 /usr/lib/x86_64-linux-gnu/libc-client.a
    

    And compilation will done successful.

    点赞 评论 复制链接分享

为你推荐