有人有关于在 OS X 10.6.3 上编译 PHP 的国际扩展的一些提示吗?
我每次尝试都会得到编译错误,我已经在谷歌上搜索了很长时间,但一无所获。非常感谢任何帮助。
当 make 转到巨大的 gcc 命令来编译 libphp5.bundle 时,我收到以下错误:
Undefined symbols:
"___gxx_personality_v0", referenced from:
icu_4_2::MessageFormatAdapter::getArgTypeList(icu_4_2::MessageFormat const&, int&)in msgformat_helpers.o
_umsg_parse_helper in msgformat_helpers.o
_umsg_format_arg_count in msgformat_helpers.o
_umsg_format_helper in msgformat_helpers.o
CIE in msgformat_helpers.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
我的编译命令是:
MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch x86_64 -g -Os -pipe"
LDFLAGS="-arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
./configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-curl=/usr \
--with-gd \
--with-jpeg-dir=/src/jpeg/jpeg-local \
--with-png-dir=/usr/X11R6 \
--with-freetype-dir=/usr/X11R6 \
--with-xpm-dir=/usr/X11R6 \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-iodbc=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--with-pcre-regex=/src/pcre/pcre-local/usr/local \
--with-pcre-dir=/src/pcre/pcre-local/usr/local \
--with-icu-dir=/usr/local \
--enable-intl
export EXTRA_CFLAGS="-lresolv"
make
答案1
简单的谷歌搜索就出现了这一页。请密切关注最底部的帖子:
[2010-02-10 12:05 UTC] surfchen at gmail dot com
It is a linking problem, here is the simple workaround:
edit Makefile and add -lstdc++ into EXTRA_LIBS.
答案2
phpbrew 有一个针对此问题的补丁
https://github.com/c9s/phpbrew/commit/18ef766d0e013ee87ac7d86e338ebec89fbeb445。
你可以运行:
sed -i \'/^BUILD_/ s/\$(CC)/\$(CXX)/g\' Makefile
sed -i \'/EXTRA_LIBS = /s|$| -lstdc++|\' Makefile
为了修复这个问题。