[plug] building static binaries

James Devenish devenish at guild.uwa.edu.au
Mon Dec 29 16:04:24 WST 2003


In message <1072683920.15478.26.camel at lukenew>
on Mon, Dec 29, 2003 at 03:45:21PM +0800, Luke Dudney wrote:
> Yes, I have /usr/lib/libresolv.a owned by glibc-devel. configure.log has
> this error
> 
> configure:5214: checking for res_mkquery in -lresolv
> configure:5245: gcc -o conftest -g -O2  -static conftest.c -lresolv 
> -lc  >&5
> /tmp/cc2uxyd7.o(.text+0xa): In function `main':
> /home/luke/src/etherape-0.9.0/configure:5272: undefined reference to
> `res_mkquery'
> collect2: ld returned 1 exit status

Hehe...I see that ./configure uses one-liner compilation/linking, so
CFLAGS will be equivalent to LDFLAGS during ./configuration (but
probably not during the actual build). Some vendors' man pages let you
know what libraries need to be linked, but we can at first assume it'll
be libresolv.a. I find that:

% nm `locate libresolv.a` | fgrep res_mkquery
000000a0 T __res_mkquery
res_mkquery.o:

So...it does seem to be there. However, I have now inspected the
./configure file from EtherApe. It seems that the ./configure test uses
a little bit of trickery to test for the presence of functions and I
guess that this only works with the dynamic loader or something (I don't
recognise the programming motif myself). I'm not sure how you can work
around this, other than to ./configure without -static and then insert
-static into the Makefiles or Makedefs files. (I also note that there is
some comment in the ./configure test that says "use char because int
might match the return type of a gcc2 builtin and then its argument
prototype would still apply.") It is possible that you could `make
LDFLAGS=-static`, but the Makefile would need to support that.





More information about the plug mailing list