BIND8, BIND9 static compilation problems

Mark_Andrews at isc.org Mark_Andrews at isc.org
Thu Sep 25 23:50:11 UTC 2003


	Glibc contains a weak references to handle the differences
	between threaded and non-threaded builds.  BIND 8.4.2
	contains a work-around.

	Mark

lib/irs/irs_data.c:
#ifdef _REENTRANT
struct __res_state *
__res_state(void) {
        /* NULL param here means use the default config file. */
        struct net_data *net_data = net_data_init(NULL);
        if (net_data && net_data->res)
                return (net_data->res);
 
        return (&_res);
}
#else
#ifdef __linux
struct __res_state *
__res_state(void) {
        return (&_res);
}  
#endif
#endif


> To: BIND (mlist) users
> Subject: BIND8, BIND9 static compilation problems
> Date: 25.Sep.2003 16:30 GMT+1
> 
> Hi to all,
> I have question for all experienced BIND users. I have successfully 
> compiled and chrooted both BIND8 and BIND9, but dynamically linked to 
> libs. Now I like to add additional security by removing all libraries 
> from chroot environment because I don't like to have libc.so.X in 
> chroot. I tried to put -static to /bind-
> source/src/port/linux/Makefile.set  in CDEBUG line with no success. 
> This didn't help either: export LDFLAGS=-static 
> export CFLAGS="-static -static-libgcc". 
> 
> Now I'm quite stuck here and I would appreciate any help with this. I 
> checked both google and m.list archives and find no answer, or just 
> more questions to same question ("How to compile bind statically"). I 
> saw few people doing lot of BIND source modifications to get BIND 
> statically compiled, but I don't like it and that diff patches where 
> created for old 8.2.x versions. I would like to hear developer opinions 
> about this too.
> 
> BIG thanks to all!
> Ivan
> 
> 
> 
> Here is one of (common) compile errors that BIND8 gives:
> 
> -- snip --
> gcc -D_GNU_SOURCE -I../../port/linux/include -I../../include -
> D_PATH_HELPFIL
> E=\"/var/named/lib/nslookup.help\" -O -g -static -static-libgcc  -c
> commands.c
> gcc -D_GNU_SOURCE -O -g -static -static-libgcc   -o nslookup main.o
> getinfo.o debug.o send.o skip.o list.o subr.o commands.o \
>         ../../lib/libbind.a -lfl
> /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../libc.a(res_libc.o)
> (.tex
> t+0x10): In function `__res_init':
> : multiple definition of `__res_init'
> ../../lib/libbind.a(res_data.o)
> (.text+0x0):/usr/local/src/compile/bind/src/li
> b/resolv/res_data.c:85: first defined here
> /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../../i386-slackware-
> linux
> /bin/ld: Warning: size of symbol `__res_init' changed from 101 to 112 in
> /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../libc.a(res_libc.o)
> collect2: ld returned 1 exit status
> make[2]: *** [nslookup] Error 1
> make[2]: Leaving directory 
> `/usr/local/src/compile/bind/src/bin/nslookup'
> make[1]: *** [all] Error 1
> make[1]: Leaving directory `/usr/local/src/compile/bind/src/bin'
> make: *** [all] Error 1
> -- snap --
> 
> 
> OS: Slackware 9
> 
> uname:
> Linux xeon 2.4.22 #2 Wed Aug 6 14:05:00 CEST 2003 i686 unknown
> 
> gcc:
> Thread model: posix
> gcc version 3.2.2
> 
> glibc:
> GNU C Library stable release version 2.3.1, by Roland McGrath et al.
> Compiled by GNU CC version 3.2.2.
> 
> 
> 
> 
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org


More information about the bind-users mailing list