Linking error: libbind9.a doesn't find libisccfg.a methods

Mark Andrews Mark_Andrews at isc.org
Sat Sep 6 23:36:03 UTC 2008


	You have the link order wrong.  -lbind9 should be before -lisccfg.

> Hi
> 
> We are using the BIND libraries into our product internally. I can 
> successfully build the product on Windows, Solaris 10, but I have 
> problems on Linux RedHat. The problem linking on Linux is that linker 
> doesn't find certain methods. The methods are compiled and are available 
> in a static library.
> 
> What I've already done:
> 1. I checked the library and I see the methods in there (using objdump)
> 2. I ensured that the library I am looking to is the one considered by 
> the linker (I renamed the library and the linker complained can't find 
> it anymore)
> 
> Different outputs following:
> 
> i. the linker output
> g++ -o <our executable> -g -g -Wall -Wformat -march=i586 -mtune=i586 
> -Dlinux -D__i386 -D_POSIX_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE 
> -L/export/raduda/bind-9.4.2-P2/linux/lib  -L. -L../../lib/util 
> -L../../lib/nidsnmp                   -L../../lib/BINDlibs/libuc_new 
> -L../../lib/BINDlibs/libjr 
> -L../../thirdparty/openssl-0.9.8e/linux/lib                   
> -L../../lib/BINDlibs/libcc 
> -L../../lib/BINDlibs/libzsign                   
> -L../../lib/BINDlibs/libcheck                   
> -L../../thirdparty/Xerces2.7/linux/lib   -L/usr/lib    <our compiled 
> objects> -Wl,-a,shared -lpthread -lc                  -Wl,-a,archive 
> -lupdc -lnidsnmp -ljr -lnbccc -lzsign -lcheck                  -lutil 
> -lisccfg -lbind9 -ldns -lisccc -lisc -lcrypto                  
> -Wl,-a,shared -lxerces-c      -Wl,-rpath,/usr/lib
> ../../lib/util/libutil.a(netid_file.o)(.text+0xb33): In function 
> `netid_create_temporary_file':
> : warning: the use of `mktemp' is dangerous, better use `mkstemp'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x915): 
> In function `checkacl':
> /export/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:382: undefined 
> reference to `cfg_acl_fromconfig'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x1e44): 
> In function `check_viewconf':
> /export/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:1417: 
> undefined reference to `cfg_aclconfctx_init'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x269a):/exp
> ort/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:1550: 
> undefined reference to `cfg_aclconfctx_destroy'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x38a0): 
> In function `bind9_check_namedconf':
> /export/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:1746: 
> undefined reference to `cfg_aclconfctx_init'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x39a1):/exp
> ort/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:1765: 
> undefined reference to `cfg_acl_fromconfig'
> /export/raduda/bind-9.4.2-P2/linux/lib/libbind9.a(check.o)(.text+0x3e4e):/exp
> ort/raduda/bind-9.4.2-P2-no-openssl/lib/bind9/check.c:1813: 
> undefined reference to `cfg_aclconfctx_destroy'
> collect2: ld returned 1 exit status
> make: *** [nidnbcd] Error 1
> 
> ii. [raduda_4.6.0_linux_dyn] 0:20 dellux(raduda) /export/raduda> objdump 
> -t  bind-9.4.2-P2/linux/lib/libisccfg.a
> In archive bind-9.4.2-P2/linux/lib/libisccfg.a:
> 
> aclconf.o:     file format elf32-i386
> 
> SYMBOL TABLE:
> 00000000 l    df *ABS*  00000000 aclconf.c
> 00000000 l    d  .text  00000000
> 00000000 l    d  .data  00000000
> 00000000 l    d  .bss   00000000
> 00000000 l    d  .debug_abbrev  00000000
> 00000000 l    d  .debug_info    00000000
> 00000000 l    d  .debug_line    00000000
> 00000000 l    d  .rodata.str1.4 00000000
> 00000000 l    d  .rodata.str1.1 00000000
> 00000000 l    d  .debug_frame   00000000
> 00000000 l    d  .debug_loc     00000000
> 00000000 l    d  .debug_pubnames        00000000
> 00000000 l    d  .debug_aranges 00000000
> 00000000 l    d  .debug_ranges  00000000
> 00000000 l    d  .debug_str     00000000
> 00000000 l    d  .note.GNU-stack        00000000
> 00000000 l    d  .comment       00000000
> 00000000 g     F .text  00000015 cfg_aclconfctx_init
> 00000018 g     F .text  00000037 cfg_aclconfctx_destroy
> 00000000         *UND*  00000000 dns_acl_detach
> 00000050 g     F .text  00000784 cfg_acl_fromconfig
> and following
> 
> I modified your code and moved entire content of aclconf.c into 
> parser.c. Built the libisccfg.a again and tried linking again: it worked 
> right away! Now libbind9.a doesn't complain!
> 
> I am aware that maybe isn't BIND related issue, still, do you have any 
> idea WHY it happens like this?
> And secondly, is my solution safe?
> 
> Thx, Radu
> p.s. yes, it is BIND-9.4.2-P2
> 
-- 
Mark Andrews, ISC
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