I have a C++ JNI Library (that I did not write myself) that uses the functionality of libpcap. There are only a few functions that are actually being used from libpcap but when the library is compiled, every function gets included. Perhaps it's a flag? I've searched and can't seem to find an answer to my question.
The older developers were using BJAM to do the compile, and I've recently been tasked to convert it to GNU Make.
Here are all the pcap symbols in my Make compile:
00000000000197f0 T _pcap_activate
0000000000019d00 T _pcap_breakloop
0000000000019070 T _pcap_can_set_rfmon
0000000000019bb0 T _pcap_close
000000000001b560 T _pcap_compile
000000000001c180 T _pcap_compile_nopcap
00000000000192c0 T _pcap_create
0000000000019d10 T _pcap_datalink
0000000000019d30 T _pcap_datalink_ext
0000000000019ff0 T _pcap_datalink_name_to_val
000000000001a080 T _pcap_datalink_val_to_description
0000000000019f70 T _pcap_datalink_val_to_name
00000000000191c0 T _pcap_dispatch
000000000003b660 T _pcap_dump
000000000003bde0 T _pcap_dump_close
000000000003bda0 T _pcap_dump_file
000000000003bdc0 T _pcap_dump_flush
000000000003b8d0 T _pcap_dump_fopen
000000000003bdb0 T _pcap_dump_ftell
000000000003b6d0 T _pcap_dump_open
000000000003b940 T _pcap_dump_open_append
000000000003a650 T _pcap_ether_aton
000000000003a780 T _pcap_ether_hostton
000000000001a240 T _pcap_file
000000000001a250 T _pcap_fileno
0000000000019220 T _pcap_findalldevs
000000000003acd0 T _pcap_fopen_offline
000000000003a910 T _pcap_fopen_offline_with_tstamp_precision
0000000000019e20 T _pcap_free_datalinks
0000000000019140 T _pcap_free_tstamp_types
000000000001af60 T _pcap_freealldevs
000000000001c1f0 T _pcap_freecode
000000000001a260 T _pcap_get_selectable_fd
00000000000197e0 T _pcap_get_tstamp_precision
000000000001a2a0 T _pcap_geterr
000000000001a2b0 T _pcap_getnonblock
000000000001a760 T _pcap_inject
000000000001a1e0 T _pcap_is_swapped
000000000001a7a0 T _pcap_lib_version
0000000000019d50 T _pcap_list_datalinks
0000000000019080 T _pcap_list_tstamp_types
000000000001b010 T _pcap_lookupdev
000000000001b0a0 T _pcap_lookupnet
0000000000019c80 T _pcap_loop
000000000001a200 T _pcap_major_version
000000000001a220 T _pcap_minor_version
000000000003a150 T _pcap_nametoaddr
000000000003a1a0 T _pcap_nametoaddrinfo
000000000003a4c0 T _pcap_nametoeproto
000000000003a520 T _pcap_nametollc
000000000003a1f0 T _pcap_nametonetaddr
000000000003a210 T _pcap_nametoport
000000000003a2c0 T _pcap_nametoportrange
000000000003a4a0 T _pcap_nametoproto
0000000000019180 T _pcap_next
00000000000191d0 T _pcap_next_ex
000000000001a770 T _pcap_offline_filter
000000000001a6c0 T _pcap_open_dead
000000000001a5f0 T _pcap_open_dead_with_tstamp_precision
00000000000199a0 T _pcap_open_live
000000000003ab20 T _pcap_open_offline
000000000003a840 T _pcap_open_offline_with_tstamp_precision
000000000001a270 T _pcap_perror
000000000001a740 T _pcap_sendpacket
0000000000019720 T _pcap_set_buffer_size
0000000000019e30 T _pcap_set_datalink
00000000000196e0 T _pcap_set_immediate_mode
00000000000195a0 T _pcap_set_promisc
00000000000195e0 T _pcap_set_rfmon
0000000000019560 T _pcap_set_snaplen
0000000000019620 T _pcap_set_timeout
0000000000019760 T _pcap_set_tstamp_precision
0000000000019660 T _pcap_set_tstamp_type
000000000001a490 T _pcap_setdirection
000000000001a480 T _pcap_setfilter
000000000001a370 T _pcap_setnonblock
000000000001a1c0 T _pcap_snapshot
000000000001a4d0 T _pcap_stats
0000000000019940 T _pcap_statustostr
0000000000019130 T _pcap_strerror
000000000001a0c0 T _pcap_tstamp_type_name_to_val
000000000001a180 T _pcap_tstamp_type_val_to_description
000000000001a140 T _pcap_tstamp_type_val_to_name
And these are the only functions that should be included (BJAM compile):
U _pcap_close
U _pcap_findalldevs
U _pcap_freealldevs
U _pcap_geterr
U _pcap_next
U _pcap_open_live
U _pcap_sendpacket
U _pcap_stats
Edit
I just noticed now that these symbols are undefined... Now I am very confused. Are they using a shared version of libpcap?
Edit 2
Output from file
on make
library:
custompcap-1.2-r8581.jnilib: Mach-O universal binary with 2 architectures
custompcap-1.2-r8581.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
custompcap-1.2-r8581.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
Output from BJAM library:
target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib: Mach-O 64-bit dynamically linked shared library x86_64
Edit 3
Here is the linker
c++ -stdlib=libstdc++ -lstdc++ -Wl,-single_module -install_name custompcap.jnilib -dynamiclib -o target/x86_64-apple-darwin14.1.0/lib/custompcap.jnilib target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNICapture.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNINetworkInterface.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/JNIcustomcap.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/HexDump.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/Timer.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/util/DataStream.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPDefrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/frag/IPFrag.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapInput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/pcap/PcapOutput.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/IPPacket.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketBundle.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketDispatch.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Headers.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/PacketRule.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/CIDR.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/BoyerMoore.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Piranha.o target/x86_64-apple-darwin14.1.0/obj/src/main/cpp/customcap/Packetcustomcap.o -L/Users/vdawn/src/3rdparty/pcap/libpcap/1.8.0-PRE-GIT/ -lpcap -lpcre -headerpad_max_install_names -Wl,-dead_strip -no_dead_strip_inits_and_terms -arch x86_64
Thanks