现在的位置: 首页 > IT运维 > 正文

Undefined symbols for architecture x86_64: _res_9_init

2011年10月31日 IT运维 ⁄ 共 1490字 暂无评论 ⁄ 被围观 195+

在MAC(OSX)下编译PHP 5.3.8(打开MySQL支持,--with-mysql,--with-mysqli)时会遇到如下错误:

[php]Undefined symbols for architecture x86_64:Undefined
"symbols for architecture_res_9_init "x86_64,:
referenced from: "_res_9_init"
, referenced from:
_zif_dns_get_mx in dns.o
_zif_dns_get_mx _zif_dns_get_record in indns.o
dns.o
_zif_dns_check_record_zif_dns_get_record inin dns.o
_zif_dns_check_record dns.oin
dns.o
" "_res_9_search",_res_9_search", referenced referenced from:
from:
_zif_dns_get_mx_zif_dns_get_mx in dns.o
in dns.o
_zif_dns_get_record in dns.o
_zif_dns_get_record in dns.o
_zif_dns_check_record in dns.o
_zif_dns_check_record "in_res_9_dn_skipname", referenced from:
dns.o
" _res_9_dn_skipname_zif_dns_get_mx" in , dns.o
referenced from:
_zif_dns_get_mx _zif_dns_get_record in dns.o
in dns.o
" _res_9_dn_expand", referenced from:
_zif_dns_get_record in dns.o
"_zif_dns_get_mx_res_9_dn_expand", referenced fromin dns.o
:
_php_parserr in dns.o
ld : _zif_dns_get_mx insymbol (dns.os) not
found for architecture x86_64_php_parserr
in dns.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [sapi/cgi/php-cgi] Error 1[/php]

解决方法有2种:

1、使用PHP内置的MySQL驱动, 用mysqlnd代替你的mysql的安装路径:

[php]--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd[/php]

2、如果方法1无效,试下这个终极解决方案:

[php]sudo install_name_tool -id /your/mysq/path/lib/libmysqlclient.18.dylib /your/mysq/path//lib/libmysqlclient.dylib[/php]

我是使用方法2才做成功的,这个问题困扰了我一整天啊。。。

导致这个编译问题的原因是变量HAVE_DNS_SEARCH和HAVE_RES_NSEARCH在PHP和MySQL中的定义冲突。

给我留言

您必须 [ 登录 ] 才能发表留言!

×
#