Re: compilation problem with dnsserver.c

From: Jonathan Larmour <[email protected]>
Date: Thu, 11 Feb 1999 15:55:45 +0000

Ettore De Simone wrote:
>
> On 10-Feb-99 Jon Bernard wrote:
> > gcc -o dnsserver -g dnsserver.o -L../lib -lmiscutil -lm -lresolv -lnsl
> > /lib/libresolv.a(res_send.o)(.text+0x80): undefined reference to
> > `strerror'

> I got that error on every Sun machine I tried it, both on SunOS and Solaris,
> and I am not the only one here. It seems to be a peculiarity of those systems...
>
> (It seems the linker isn't able to find strerror.o in libmiscutil. I still
> can't understand why, as I can see it using ar)

Because the undefined reference came from libresolv.a, not from dnsserver.o,
and -lresolv is _after_ -lmiscutil in the link line.

And nor is it a bug in Sun ld - this is well defined behaviour for linkers.

The problem is that his libresolv.a has a reference to strerror, when there
is no strerror in libc. By looking on my Sunos 4 box here, the libresolv.a
has no reference to strerror, so I suspect he got his resolver from some
other place which made an assumption that strerror is on his system.

He can fix this for the purposes of squid's dnsserver, but his resolver is
still broken and he could stumble across this problem again when linking
some other program with it.

Jifl

-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"Women marry hoping their husbands will change, men||Home e-mail: jifl @ 
marry hoping their wives never do. Both are rare." ||     jifvik.demon.co.uk
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault
Received on Thu Feb 11 1999 - 09:48:27 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:44:32 MST