在linux中编译php 5.3,出现如下错误
lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -o sapi/fpm/php-fpm
ext/standard/dns.o: In function `php_parserr':
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:418: undefined reference to `__dn_expand'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:468: undefined reference to `__dn_expand'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:652: undefined reference to `__dn_expand'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:674: undefined reference to `__dn_expand'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:513: undefined reference to `__dn_expand'
ext/standard/dns.o:/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:519: more undefined references to `__dn_expand' follow
ext/standard/dns.o: In function `zif_dns_check_record':
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:393: undefined reference to `__res_nsearch'
ext/standard/dns.o: In function `zif_dns_get_mx':
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:925: undefined reference to `__res_nsearch'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:936: undefined reference to `__dn_skipname'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:943: undefined reference to `__dn_skipname'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:956: undefined reference to `__dn_expand'
ext/standard/dns.o: In function `zif_dns_get_record':
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:808: undefined reference to `__res_nsearch'
/home/lianjie.ning/php-5.3.6/ext/standard/dns.c:825: undefined reference to `__dn_skipname'
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
方法一、找到Makefile文件,在EXTRA_LIBS最后添加-lresolv
EXTRA_LIBS = -lcrypt -lcrypt -lrt -lmysqlclient -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm –
lxml2 -lz -lm -lcrypt -lresolv
方法二、另有一解决办法:
make ZEND_EXTRA_LIBS='-liconv'