构建遇到的问题如下:
"_res_9_dn_expand", referenced from:
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr in dns.o
_php_parserr 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
_zif_dns_get_mx in dns.o
"_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
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决方法:
- 编辑
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/lang/php/Portfile
; - 在大概 350 行前后找到
if {[vercmp ${branch} < 8.0]}
,这是判定 PHP 版本是否小于 8.0 - 在判定内加上
configure.args-append EXTRA_LIBS=-lresolv
- 保存后执行
sudo port install php74
即可
修改的位置:
php74-fpm
同样需要修改该文件,在 770 行左右增加 configure.args-append EXTRA_LIBS=-lresolv
,### FPM SAPI ###
下方
如图所示: