security/nmap & gcc3.3?

Charles Swiger cswiger at mac.com
Wed Jan 28 12:39:54 PST 2004


Hi, all--

On a FreeBSD-4.9 system, nmap-3.50 builds fine using the stock cc (gcc 
version 2.95.4 20020320), but fails using gcc33 (version 3.3.3 
20040126):

9-sec# make -k
[ ... ]
10-sec# make
===>  Building for nmap-3.50
Compiling libnbase
cd nbase && make
Compiling libnsock
cd nsock/src && make
Compiling nmap
rm -f nmap
/usr/local/bin/g++33 -L/usr/local/lib  -rpath=/usr/lib:/usr/local/lib 
-L/usr/lib -Lnbase -Lnsock/src/  -o nmap main.o nmap.o targets.o 
tcpip.o nmap_error.o utils.o idle_scan.o osscan.o output.o 
scan_engine.o timing.o charpool.o services.o protocols.o nmap_rpc.o 
portlist.o NmapOps.o TargetGroup.o Target.o FingerPrintResults.o 
service_scan.o NmapOutputTable.o -lm  -lssl -lcrypto -lnbase -lnsock 
-lpcre -lpcap
main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
nmap.o: In function `nmap_main(int, char**)':
nmap.o(.text+0x1a18): undefined reference to `operator new(unsigned)'
nmap.o(.text+0x1f7a): undefined reference to `operator delete(void*)'
nmap.o(.text+0x1f8f): undefined reference to `operator delete(void*)'
nmap.o(.text+0x2ba5): undefined reference to `operator delete(void*)'
nmap.o(.text+0x2bad): undefined reference to `_Unwind_Resume'
nmap.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
targets.o: In function `nexthost(HostGroupState*, scan_lists*, int*)':
targets.o(.text+0x653): undefined reference to `operator new(unsigned)'
targets.o(.text+0x87f): undefined reference to `operator delete(void*)'
targets.o(.text+0x934): undefined reference to `operator delete(void*)'
targets.o(.text+0x93c): undefined reference to `_Unwind_Resume'
targets.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
tcpip.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
nmap_error.o(.eh_frame+0x11): undefined reference to 
`__gxx_personality_v0'
utils.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
idle_scan.o(.eh_frame+0x11): undefined reference to 
`__gxx_personality_v0'
osscan.o: In function `os_scan(Target*)':
osscan.o(.text+0x2d48): undefined reference to `operator new(unsigned)'
osscan.o(.text+0x2db0): undefined reference to `operator delete(void*)'
osscan.o(.text+0x2de4): undefined reference to `_Unwind_Resume'
osscan.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
[ ... ]
collect2: ld returned 1 exit status
*** Error code 1

Stop in /usr/ports/security/nmap/work/nmap-3.50.
*** Error code 1

Stop in /usr/ports/security/nmap.

	====

I would gather that nmap is setting the linking path in a fashion which 
causes the gcc33 version of libstdc++ to not be found, or to not be 
linked in by default?

Retrying the linking stage by hand as follows produces a working binary:

58-sec# /usr/local/bin/g++33  
-L/usr/local/lib/gcc-lib/i386-portbld-freebsd4.9/3.3.3/ 
-L/usr/local/lib  -rpath=/usr/lib:/usr/local/lib -L/usr/lib -Lnbase 
-Lnsock/src/  -o nmap main.o nmap.o targets.o tcpip.o nmap_error.o 
utils.o idle_scan.o osscan.o output.o scan_engine.o timing.o charpool.o 
services.o protocols.o nmap_rpc.o portlist.o NmapOps.o TargetGroup.o 
Target.o FingerPrintResults.o service_scan.o NmapOutputTable.o -lm  
-lssl -lcrypto -lnbase -lnsock -lpcre -lpcap -lstdc++

[ Other ports I've tried which use g++33 link fine; this problem seems 
specific to security/nmap... ]

-- 
-Chuck



More information about the freebsd-ports mailing list