![在 Mac OSX 10.6 上使用 iconv 安装 PHP 时出现错误:“未定义架构 x86_64 的符号”](https://linux22.com/image/545608/%E5%9C%A8%20Mac%20OSX%2010.6%20%E4%B8%8A%E4%BD%BF%E7%94%A8%20iconv%20%E5%AE%89%E8%A3%85%20PHP%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF%EF%BC%9A%E2%80%9C%E6%9C%AA%E5%AE%9A%E4%B9%89%E6%9E%B6%E6%9E%84%20x86_64%20%E7%9A%84%E7%AC%A6%E5%8F%B7%E2%80%9D.png)
我正在使用 iconv 在本地 Web 服务器上设置 PHP,它应该默认存在,但我收到以下错误:
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
__php_iconv_strlen in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_appendl in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
...
(maybe you meant: _zif_iconv_strlen, _zif_iconv_strpos , _zif_iconv_mime_decode , _php_iconv_string , _zif_iconv_set_encoding , _zif_iconv_get_encoding , _zif_iconv_mime_decode_headers , _iconv_functions , _zif_iconv_mime_encode , _zif_iconv_strrpos , _iconv_module_entry , _iconv_globals , _zif_iconv_substr , _php_if_iconv , _zif_ob_iconv_handler )
ld: symbol(s) not found for architecture x86_64
现在,这可能意味着我的 iconv 不是 64 位的。我尝试下载 libiconv然后手动重新安装 64 位版本,如下所示:
CFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' CCFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' CXXFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' ./configure
但我收到以下错误:
configure: error: in `/Users/jason/Downloads/libiconv-1.13.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.
在我的 config.lob 文件中,底部显示:
configure: exit 77
有什么建议么?
答案1
我在 OS X 10.7 上遇到了完全相同的问题,即由于 libiconv x86_64 错误而无法编译 PHP,但已按如下方式解决:
构建仅限 x86_64 版本的 libiconv:
CFLAGS='-arch x86_64' CCFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' ./configure
make
sudo make install
这会将编译后的文件放在 /usr/local/lib 中
然后在 PHP 源目录中运行 ./configure,然后“make”
当您收到 iconv 错误时,复制最后一个 gcc 命令(失败的命令),将开始更改为:
gcc -bundle -bundle_loader /usr/sbin/httpd -L/usr/local/lib
所以它指向仅 64 位版本。然后粘贴新命令并再次运行“make”,它就可以正常工作了(至少对我来说是这样)。