To begin with, I would normally opt to use a pre-compiled binary of PHP, but am required to build from source for a specific business need. (I'm not the type that compiles open-source apps just for kicks.)
I'm building on OS X 10.6 and am running into the following error when I try to make
PHP 5.2.10 as an Apache module (--with-apxs2
):
Undefined symbols:
"_res_9_dn_expand", referenced from:
_zif_dns_get_mx in dns.o
"_res_9_search", referenced from:
_zif_dns_get_mx in dns.o
_zif_dns_check_record in dns.o
"_res_9_dn_skipname", referenced from:
_zif_dns_get_mx in dns.o
_zif_dns_get_mx in dns.o
ld: symbol(s) not found
These symbols are part of libresolv
, which is included at /usr/lib/libresolv.dylib
on OS X (and has been since at least 10.4). Note that *.dylib
files are the Mac equivalent of *.so
files on Linux, and I've successfully compiled in libiconv.dylib
already by passing --with-iconv=shared,/usr
to ./configure
, which eliminated similar linker errors for the iconv
library.
When I run ./configure
, it detects /usr/include/resolv.h
and enables it in the makefile. However, I can't seem to figure out how to get the shared library to link in correctly. Any tips on getting that to work? I've never done anything like passing custom linker flags to ./configure
, and Google has been no help to me for this problem, unfortunately.
Edit: I'm building from this TAR download if anyone wants to try to replicate the error on Snow Leopard.
Try adding -lresolv to your Makefile.
Hope this helps. I got the suggestion from this discussion.
If you set the configure environment variable before running the configure script, you don't have to edit the makefile. For example:
LIBS=-lresolv ./configure --with-apxs2 --with-gd (etc.)
This solution worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With