tcpdump mailing list archives

Re: Building tcpdump with static libraries


From: Guy Harris <guy () alum mit edu>
Date: Mon, 28 May 2012 11:53:44 -0700


On May 28, 2012, at 8:01 AM, Ajith Adapa wrote:

I getting following error. Seems directly using static flag wont solve

/Ajith/LABS/submission/tcpdump/./addrtoname.c:728: warning: Using
'getservent' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
/home/codingfreak/Ajith/LABS/submission/tcpdump/./addrtoname.c:748:
warning: Using 'endservent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
print-sunrpc.o: In function `progstr':
/home/codingfreak/Ajith/LABS/submission/tcpdump/./print-sunrpc.c:163:
warning: Using 'getrpcbynumber' in statically linked applications requires
at runtime the shared libraries from the glibc version used for linking

Yes - getservent(), endservent(), and getrpcbynumber() also, on most UN*Xes, use the Name Service Switch mechanism I 
mentioned in my previous message, and...

/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x336): undefined reference to `dlsym'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
(.text+0x418): undefined reference to `dlerror'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x4a6): undefined reference to `dlsym'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
(.text+0x588): undefined reference to `dlerror'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
(.text+0x5f7): undefined reference to `dlclose'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x6d6): undefined reference to `dlopen'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x746): undefined reference to `dlclose'
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x77d): undefined reference to `dlerror'

...I guess libcrypto also does run-time loading of code, and thus needs the run-time linker APIs (dlopen(), dlsym(), 
dlclose(), and dlerror()).

So, on most UN*Xes, 100% statically linking a program intended to be run on that UN*X can be extremely difficult, if 
not impossible, for many programs.  You may have to statically link with the libraries where you need the library 
statically linked, and dynamically link with all the others.

Do you need to link statically with any library other than libpcap?-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: