the-tcpdump-group / tcpslice

tcpslice concatenates multiple pcap files together, or extracts time slices from one or more pcap files.
63 stars 22 forks source link

may fail to link because does not use pcap-config #5

Closed infrastation closed 4 years ago

infrastation commented 7 years ago

When tcpslice tries to link with libpcap that was built with dependencies on libnl, libusb or libdbus, the linking fails because tcpslice does not use pcap-config --libs --static to tell any extra libraries (as tcpdump does):

gcc -O2 -DHAVE_CONFIG_H   -D_U_="__attribute__((unused))" -I. -I./../libpcap   -o tcpslice tcpslice.o gmt2local.o gwtm2secs.o machdep.o search.o sessions.o util.o version.o strlcpy.o ./../libpcap/libpcap.a 
./../libpcap/libpcap.a(pcap-linux.o): In function `nl80211_cleanup':
/home/denis/libpcap/./pcap-linux.c:673: undefined reference to `genl_family_put'
[...]
./../libpcap/libpcap.a(pcap-canusb-linux.o): In function `canusb_close':
/home/denis/libpcap/./pcap-canusb-linux.c:329: undefined reference to `pthread_join'
/home/denis/libpcap/./pcap-canusb-linux.c:333: undefined reference to `libusb_close'
[...]
./../libpcap/libpcap.a(pcap-dbus.o): In function `dbus_write':
/home/denis/libpcap/./pcap-dbus.c:114: undefined reference to `dbus_message_demarshal'
[...]
collect2: error: ld returned 1 exit status
Makefile:92: recipe for target 'tcpslice' failed
make: *** [tcpslice] Error 1

This is a low-priority issue but whoever would be willing to work on it should consider moving tcpslice-specific source files (gwrm2secs.c, search.c, sessions.c, tcpslice.c, util.c, version.c and vfprintf.c) into the tcpdump repository to avoid duplicate maintenance work in future.

guyharris commented 4 years ago

It now does the same things to configure libpcap that tcpdump's configure script does.

infrastation commented 4 years ago

I confirm the fix, thank you very much for porting the autotools props.