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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?