The normal build process for libpcap does not install a shared library (.so), but rather an archive (.a). Many Linux distributions come with older libpcap libraries and the PHREL build process will attempt to link them instead of the library archive.
To get around this issue, extract the libpcap tarball (eg: libpcap-0.9.4.tar.gz) in the same directory that the PHREL archive was extracted and build libpcap before running the PHREL configure script. This will allow PHREL to locate your newly created pcap library archive (libpcap.a) and link against it.
Optionally, you could replace your systems pcap library by via a package manager (RPM, etc) or manually by building libpcap as follows:
- Code: Select all
> tar xvzf libpcap-0.9.4.tar.gz
> cd libpcap-0.9.4/
> ./configure --prefix=/usr
> su -c 'make install-shared'
> su -c 'rm /usr/lib/libpcap.so; ln -s libpcap.so.0.9.4 /usr/lib/libpcap.so'
> su -c '/sbin/ldconfig'
Example of "undefined refernece to pcap_next_ex" errors:
- Code: Select all
gcc -g -O2 -o phreld capture.o data_hash.o phrel.o prefs.o thread.o util.o trap.o ../lib/libsnmptrap.a ../lib/libconfiguration.a -L/usr/local/lib -lnetsnmp -lcrypto -lm -pthread -lpcap
capture.o: In function `capture':
/home/sella/phrel/src/capture.c:125: undefined reference to `pcap_next_ex'
phrel.o: In function `main':
/home/sella/phrel/src/phrel.c:188: undefined reference to `pcap_lib_version'
prefs.o: In function `exclude_interfaces':
/home/sella/phrel/src/prefs.c:989: undefined reference to `pcap_findalldevs'
/home/sella/phrel/src/prefs.c:1026: undefined reference to `pcap_freealldevs'
collect2: ld returned 1 exit status
make[2]: *** [phreld] Error 1
- Code: Select all