在Solaris 10 64位上configurationPHP

我们目前在Solaris 10服务器上运行PHP 5.2.13。 我需要启用一些额外的function,所以我去运行configuration脚本,但我得到一些错误。

我做了一个'export CFLAGS =“ – m64”'来确保在64位模式下编译GCC,但是看起来我没有64位版本的libiconv.so。 我试着用'–without-iconv'运行脚本,但没有骰子。 这是我的config.log的结尾:

configure:20017: checking for strftime configure:20471: checking whether to enable LIBXML support configure:20519: checking libxml2 install dir configure:20548: checking for xml2-config path configure:20706: checking whether libxml build works configure:20733: gcc -o conftest -m64 -D_POSIX_PTHREAD_SEMANTICS -R/usr/ucblib -L/usr/ucblib -R/usr/local/lib/../lib/gcc/sparc-sun-solaris2.10/3.4.6 -L/usr/local/lib/../lib/gcc/sparc-sun-solaris2.10/3.4.6 -R/usr/local/lib -L/usr/local/lib conftest.c -lrt -lresolv -lm -lnsl -lsocket -lgcc -lxml2 -lz -liconv -lm -lsocket -lnsl 1>&5 ld: fatal: file /usr/local/lib/libiconv.so: wrong ELF class: ELFCLASS32 ld: fatal: File processing errors. No output written to conftest collect2: ld returned 1 exit status configure: failed program was: #line 20722 "configure" #include "confdefs.h" char xmlInitParser(); int main() { xmlInitParser(); return 0; } 

有没有办法解决? 自昨天以来,我一直在抨击这件事。 如果有帮助,这是我的configuration线:

 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/lib --with-libxml-dir=/usr/local --with-zlib=/usr/local --with-xpm-dir=/usr/local --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --without-pgsql --with-jpeg-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib --with-gd=/usr/local --enable-mbstring --enable-exif --enable-force-cgi-redirect --enable-sockets --with-png-dir=/usr/local/lib --with-curl=/usr/local --with-ldap=/usr/local --with-openssl=/usr/local/ssl --with-gettext --with-pcre-dir=/usr/local --with-freetype-dir=/usr/local --with-mssql=/usr/local/freetds --with-readline --enable-soap 

对于Solaris来说,这一直是我最大的麻烦。 本质上,如果你要编译的东西,你需要确保以下所有是正确的:

  • CFLAGS / CXXFLAGS (用于C ++)
  • LDFLAGS (链接器)
  • 可能是LD_LIBRARY_PATH

确保任何包含dirs(用-I指定)和库目录( -R和/或-L )都与您正在构build的体系结构相匹配。 对于Solaris, gcc通常首先查看/usr/lib/usr/sfw/lib等,但是如果您需要64位,则需要针对/usr/lib/64 /usr/sfw/lib/64进行编译,等 – 指定gcc -m64是不够的,它做到这一点。

您可以使用lddfile来validation现有iconv库的ISA。 如果你自己编译libiconv,你需要重新编译它,否则find另一个二进制源或重新编译它:-)

在我的情况下,为了编译PHP 5.4.7,我还必须添加PHP_LDFLAGS env var:LDFLAGS =“ – L / opt / selfcompiled / libs / 64 -L / lib / 64 -L / usr / sfw / lib / 64 -m64“PHP_LDFLAGS = $ LDFLAGS