Nmap Development mailing list archives

Re: Nmap static build fails


From: John Spencer <maillist-nmap () barfooze de>
Date: Tue, 18 Sep 2012 01:23:47 +0200

On 09/17/2012 09:17 PM, David Fifield wrote:
On Mon, Sep 17, 2012 at 02:07:42PM +0200, Florian Roth wrote:
"make static" fails.

libpcap/libpcap.a(nametoaddr.o): In function `pcap_nametonetaddr':
/home/froth/nmap-5.36TEST4/libpcap/./nametoaddr.c:151: warning: Using
'getnetbyname' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
libpcap/libpcap.a(nametoaddr.o): In function `pcap_nametoproto':
/home/froth/nmap-5.36TEST4/libpcap/./nametoaddr.c:267: warning: Using
'getprotobyname' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
libpcap/libpcap.a(nametoaddr.o): In function `pcap_nametoport':
/home/froth/nmap-5.36TEST4/libpcap/./nametoaddr.c:181: warning: Using
'getservbyname' in statically linked applications requires at runtime
the shared libraries from the glibc version used for linking
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer
equality in `/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../libc.a(strcmp.o)'
can not be used when making an executable; recompile with -fPIE and
relink with -pie
collect2: ld returned 1 exit status
make[2]: *** [nmap] Error 1
make[2]: Leaving directory `/home/froth/nmap-5.36TEST4'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/froth/nmap-5.36TEST4'
make: *** [static] Error 2

I'm seeing this error too with "make static". I haven't seen it before,
so it's probably caused by some change in the GCC build chain. A few
minutes of web searching didn't reveal an obvious cause.

David Fifield

glibc makes static linking hard to impossible. some parts of it (network related, iirc) are used via dlopen'ing of another .so file.

if nothing else in the nmap sources and the shitload of libraries it includes in its own tree depends on shared object's loaded via dlopen, you can compile it against musl libc instead of glibc using one of the musl cross compilers available from https://bitbucket.org/GregorR/musl-cross/downloads .

here are some patches that you will need to build nmap against musl
https://github.com/rofl0r/sabotage/blob/master/pkg/nmap
https://github.com/rofl0r/sabotage/blob/master/KEEP/nmap-nbase_h.patch
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: