这是我在配置后运行 make
后得到的消息。
Undefined symbols for architecture x86_64:
"_res_9_init", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_record in dns.o
_zif_dns_get_mx in dns.o
"_res_9_search", referenced from:
_zif_dns_check_record in dns.o
_zif_dns_get_record in dns.o
_zif_dns_get_mx in dns.o
"_res_9_dn_skipname", referenced from:
_zif_dns_get_record in dns.o
_zif_dns_get_mx in dns.o
"_res_9_dn_expand", referenced from:
_php_parserr in dns.o
_zif_dns_get_mx in dns.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我是如何配置的
./configure --prefix=/usr/ --with-apxs2=/usr/sbin/apxs --with-mysql \
--with-pear --with-pdo-pgsql \
--with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock \
--with-pgsql --with-zlib \
--with-zlib-dir=/usr \
--with-openssl \
--without-iconv \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-mbregex \
--enable-sockets
请问有人可以帮忙吗?
最佳答案
这个 3 年多的错误(提到了 here 和 here,为什么他们还没有修复它?)也可以通过执行以下操作(或者可能通过将不正确的库移出路径)来解决,这也可能有效)。
编辑您的 Makefile
并将以下标志添加到 EXTRA_LIBS =
部分(除了已经存在的其他标志之外):
EXTRA_LIBS = -lsResolv
你提到的第二个错误:ext/phar/phar.php] Error 133
是由于MySQL二进制安装程序安装的“lib”目录中的文件之一 没有绝对路径(这已经是一段时间以来的错误了,为什么 Oracle 不修复它??)。如果您查看您提到的错误行上方的几行,您会看到它说:
Generating phar.php
dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/...
通过执行此操作检查该文件(将下面的版本号替换为您的版本号,例如 mysql-5.x.xx)。请注意结果,它不像其他文件引用那样包含完整路径:
# otool -L /usr/local/mysql-5.6.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib
然后像这样修复它:
# sudo install_name_tool -id /usr/local/mysql-5.6.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.6.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib
再次检查以确保:
# otool -L /usr/local/mysql-5.6.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib
现在,你应该可以编译成功了。
关于php - 在 Mac Mini lion 服务器上从源代码编译 PHP 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11456965/