duanjiaolao1187 2009-07-30 04:23
浏览 51
已采纳

在OS X上从源代码构建PHP 5.2.10时链接libresolv的错误

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.

  • 写回答

4条回答 默认 最新

  • duanjiu6697 2009-07-30 04:36
    关注

    Try adding -lresolv to your Makefile.

    Hope this helps. I got the suggestion from this discussion.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题