[squid-users] ld: Undefined symbols: _res_9_init compiling squid 3.2.0.15 with --disable-internal-dns option on Mac OS X 10.4.11

From: <gewehre_at_gmx.net>
Date: Sun, 19 Feb 2012 04:08:49 +0100

I had never attempted building with the --disable-internal-dns option before. Today, in the hope of enabling cache_dns_program, I tried it with squid-3.2.0.15-20120218-r11508. It barfed building /usr/local/squid/libexec/dnsserver:

libtool: link: /usr/bin/ar cru .libs/libsquid.a .libs/comm.o .libs/CommCalls.o .libs/DescriptorSet.o .libs/SquidConfig.o
libtool: link: ranlib .libs/libsquid.a
libtool: link: ( cd ".libs" && rm -f "libsquid.la" && ln -s "../libsquid.la" "libsquid.la" )
g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/usr/local/squid/etc/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/local/squid/share\" -DDEFAULT_SQUID_CONFIG_DIR=\"/usr/local/squid/etc\" -I.. -I../include -I../lib -I../src -I../include -I/usr/include -I/usr/include -I../libltdl -I../src -I../libltdl -I/usr/include -I/usr/include -I/usr/include -I/usr/include -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -c -o dnsserver.o dnsserver.cc
/bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -g -o dnsserver dnsserver.o -L../compat -lcompat-squid
libtool: link: g++ -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -g -o dnsserver dnsserver.o -Wl,-bind_at_load -L/private/var/tmp/folders.501/TemporaryItems/squid-3.2.0.15-20120218-r11508/compat -lcompat-squid
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_res_9_init
collect2: ld returned 1 exit status
make[3]: *** [dnsserver] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

I tried switching to compiling with gcc 4.2.1. Same problem.

ls -al /usr/lib/libresolv.dylib
lrwxr-xr-x 1 root wheel 17 Aug 4 2007 /usr/lib/libresolv.dylib -> libresolv.9.dylib

cat /usr/include/resolv.h
...
#define res_init res_9_init
...

nm /usr/lib/libresolv.dylib | grep res_9_init
9351e8d1 T _res_9_init

After searching online, this appears to be an issue peculiar to Mac OS X 10.3 or 10.4. I'm on 10.4.11. I tried a variety of workarounds:

1. Changing Makefile's "LIBS = " to "LIBS = -lkvm -lm -lresolv -lz"
2. Changing Makefile's "LDFLAGS=" to "LDFLAGS=-lresolv"
3. "export LIBS=-lresolv"
4. "export LDFLAGS=-lresolv"

The only option that worked gets squid compiling with --disable-internal-dns is #4. I'm curious why the other three weren't effective.

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Received on Sun Feb 19 2012 - 03:09:01 MST

This archive was generated by hypermail 2.2.0 : Sun Feb 19 2012 - 12:00:04 MST