Re: [dev] simple portscanner

From: v4hn <me_AT_v4hn.de>
Date: Sat, 2 Jan 2010 19:01:01 +0100

ev'ning everyone,

i got some obscure behaviour of gcc/icc over here,
is there anyone able to tell my why this happens/works?

> v4hn 18:52:19 ~/repos/netscan $ gcc -lpthread -lpcap *.o -o portscan
network.o: In function `default_device':
network.c:(.text+0x5d5): undefined reference to `pcap_lookupdev'
scan.o: In function `setupfilter':
scan.c:(.text+0x94d): undefined reference to `pcap_lookupnet'
scan.c:(.text+0xa04): undefined reference to `pcap_compile'
scan.c:(.text+0xa14): undefined reference to `pcap_geterr'
scan.c:(.text+0xa41): undefined reference to `pcap_setfilter'
scan.c:(.text+0xa51): undefined reference to `pcap_geterr'
scan.o: In function `generic_tcp_raw_scan':
scan.c:(.text+0xda4): undefined reference to `pcap_open_live'
scan.c:(.text+0xdd6): undefined reference to `pcap_get_selectable_fd'
scan.c:(.text+0x10be): undefined reference to `pcap_next_ex'
scan.c:(.text+0x1123): undefined reference to `pcap_geterr'
scan.c:(.text+0x1193): undefined reference to `pcap_close'
collect2: ld returned 1 exit status
> v4hn 18:52:31 ~/repos/netscan $ gcc -lpthread *.o -o portscan -lpcap
> v4hn 18:52:52 ~/repos/netscan $ ls portscan
portscan
> v4hn 18:53:03 ~/repos/netscan $

so I needed the following patch to compile it over here on my (lunar-)linux box.

--- makefile 2010-01-02 18:56:40.000000000 +0100
+++ makefile.patched 2010-01-02 18:58:08.000000000 +0100
@@ -13 +13 @@
- $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
+ $(CC) $(OBJS) -o $(PROG) $(LDFLAGS)

v4hn

Received on Sat Jan 02 2010 - 18:01:01 UTC

This archive was generated by hypermail 2.2.0 : Sat Jan 02 2010 - 18:36:01 UTC