clinkerlibpcapqnxmomentics

Where is the libpcap library for QNX Neutrino?


I know QNX 6.6 has libpcap as part of its standard libraries.

When I link to libpcap.a and try to use the functions, I get "undefined reference to 'function_name'".

Where is the real libpcap library I need to get it to actually work? Is there someplace I need to download it from?


I am building from Momentics, so there is no single command to build.

Under Linker > other options I have -lpcap, and under Linker > extra libraries I have pcap.

A possibility is that I need to import additional libraries, but libpcap comes with hundreds and I have no idea which ones I would need.

As for output, I get some innoculous building messages followed by my project search path, followed by 18 of these about different functions:

U:/.../target/qnx6/x86/usr/lib\libpcap.a(fad-getad.o): In function pcap_findalldevs':
(.text+0x2b): undefined reference to `getifaddrs'

Some of which are in pcap.h and some aren't. This is the complete list:

'U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(scanner.o): In function pcap_lex': (.text+0x9c8): undefined reference togetaddrinfo' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(inet.o): In function pcap_lookupnet': (.text+0x6d8): undefined reference tosocket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(inet.o): In function pcap_lookupnet': (.text+0x744): undefined reference toioctl_socket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(inet.o): In function pcap_lookupnet': (.text+0x7c8): undefined reference toioctl_socket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(pcap-bpf.o): In function pcap_set_datalink_bpf': (.text+0x16): undefined reference toioctl_socket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(pcap-bpf.o): In function pcap_stats_bpf': (.text+0x21a): undefined reference toioctl_socket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(pcap-bpf.o): In function pcap_setdirection_bpf': (.text+0x3ef): undefined reference toioctl_socket' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(pcap-bpf.o):(.text+0x49d): more undefined references to ioctl_socket' follow U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(fad-getad.o): In functionpcap_findalldevs': (.text+0x2b): undefined reference to getifaddrs' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(fad-getad.o): In functionpcap_findalldevs': (.text+0x175): undefined reference to freeifaddrs' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(gencode.o): In functiongen_mcode6': (.text+0x5777): undefined reference to freeaddrinfo' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(gencode.o): In functiongen_scode': (.text+0x5b36): undefined reference to freeaddrinfo' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametoaddr': (.text+0x2e): undefined reference to gethostbyname' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametoaddrinfo': (.text+0x93): undefined reference to getaddrinfo' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametonetaddr': (.text+0xc4): undefined reference to getnetbyname' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametoport': (.text+0xee): undefined reference to getservbyname' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametoport': (.text+0x10f): undefined reference to getservbyname' U:/shutchinson/QNX/target/qnx6/x86/usr/lib\libpcap.a(nametoaddr.o): In functionpcap_nametoproto': (.text+0x251): undefined reference to `getprotobyname'


Solution

  • You must add another library (libsocket.a) to the linker options. I.e. your linker options must be.............. -lpcap -lsocket.