C dhcpctl linking error

Sztrepka Pál szpal at szarvas.hu
Thu Dec 13 14:50:29 UTC 2012


Hi Glenn,

2012-12-13 11:09 időpontban Glenn Satchell ezt írta:
> Hi
>
> The resulting executable is huge because you have statically linked 
> in all
> the dhcp and bind9 libraries. You could try using dynamic libraries 
> which
> link in at run time.
>
> Check to see if the shared libraries exist, they will be libdns.so.* 
> eg
>
> ls /usr/lib/libdns* /usr/lib/libisc*

As you told, first I uninstall dhcp-4.2.4-P2 source package, and then 
install
the bind-9.9.2-2 and dhcp-4.2.4.2-1 distro package.
Then the /usr/lib/libdns.so* and /usr/lib/libisc.so* is really exist.

> gcc -Wall nnetd.o /usr/local/lib/libdhcpctl.a 
> /usr/local/lib/libomapi.a
> /usr/local/lib/libdst.a -L /usr/lib -ldns -lisc -o nnetd

But, when I try compile and link as you told, I get the following 
output:

gcc -Wall -O2   -c -o nnetd.o nnetd.c
gcc -Wall -O2 nnetd.o -ldhcpctl -lomapi -ldst -ldns -lisc -o nnetd
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(buffer.o): In 
function `omapi_connection_copyin':
(.text+0x81d): undefined reference to `isc_socket_fdwatchpoke'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(dispatch.o): 
In function `omapi_register_io_object':
(.text+0x3d9): undefined reference to `isc_socket_fdwatchcreate'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(dispatch.o): 
In function `omapi_reregister_io_object':
(.text+0x5e7): undefined reference to `isc_socket_fdwatchpoke'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(dispatch.o): 
In function `omapi_unregister_io_object':
(.text+0x756): undefined reference to `isc_socket_cancel'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(dispatch.o): 
In function `omapi_unregister_io_object':
(.text+0x75e): undefined reference to `isc_socket_detach'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x14): undefined reference to `dns_client_destroy'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x25): undefined reference to `isc_task_shutdown'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x31): undefined reference to `isc_task_detach'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x46): undefined reference to `isc_timermgr_destroy'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x5b): undefined reference to `isc_socketmgr_destroy'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x70): undefined reference to `isc_taskmgr_destroy'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0x90): undefined reference to `isc_appctx_destroy'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0xa5): undefined reference to `isc_mem_detach'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `isclib_cleanup':
(.text+0xb9): undefined reference to `isc_app_ctxfinish'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0xf5): undefined reference to `isc_lib_register'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x140): undefined reference to `isc_mem_create'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x159): undefined reference to `isc_appctx_create'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x16a): undefined reference to `isc_app_ctxstart'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x1a6): undefined reference to `isc_taskmgr_createinctx'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x1cc): undefined reference to `isc_socketmgr_createinctx'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x1f2): undefined reference to `isc_timermgr_createinctx'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x217): undefined reference to `isc_task_create'
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../libomapi.a(isclib.o): In 
function `dhcp_context_create':
(.text+0x260): undefined reference to `dns_client_createx'
collect2: error: ld returned 1 exit status
make: *** [nnetd] Error 1

I think the problem is with libisc.so.92.1.0
I looked in this lib (MC view), and for example really not found 
'isc_socket_fdwatchpoke' function, but 'isc__socket_fdwatchpoke' !
(and so on... the others functions also not found)
??

> If you wish, you can remove the symbol table using 'strip', compare 
> sizes
> before and after, eg:
>
> ls -l nnetd
> strip nnetd
> ls -l nnetd

Yes, the strip really effective, I tried this before, and after strip 
the exe size is "only" 1.2MB!

> regards,
> -glenn

I thinking about this linking error, but thank you your answare!




More information about the dhcp-users mailing list