kpcyrd / sniffglue

Secure multithreaded packet sniffer
https://crates.io/crates/sniffglue
GNU General Public License v3.0
1.08k stars 94 forks source link

Fails to compile on FreeBSD #94

Closed Martinfx closed 2 years ago

Martinfx commented 2 years ago

Hi, i compiled last version from master but i have issues with pcap library with cargo build

error: linking with `cc` failed: exit status: 1
 |
  = note: "cc" "-m64" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-Wl,--as-needed" "-L" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.0.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.1.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.10.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.11.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.12.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.13.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.14.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.15.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.2.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.3.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.4.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.5.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.6.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.7.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.8.rcgu.o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.sniffglue.199zzf55-cgu.9.rcgu.o" "-o" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/sniffglue-3b5ddd55e66c3ff9.2vu11454cf0imu7h.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps" "-L" "/usr/lib" "-L" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib" "-Wl,-Bstatic" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnum_cpus-639657f3193f6ea4.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libpcap_sys-21470a2bbf6780f1.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libbase64-f088c95b91f1fa96.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libusers-8e3f5640944461f1.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtoml-2bc04a3634e1ddf4.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libdirs_next-0457238c4bf4f499.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libdirs_sys_next-c3a3bf12a7d35504.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libserde_json-3ae60cb4dc81e2dd.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libitoa-a2d0520580a7e55e.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libdns_parser-f6119bce0da170e6.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libquick_error-48a3b455b21f259b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libbyteorder-6af6ff36306c647b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnix-3f0c67acff9f50d4.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libmemoffset-9a6fa1a51e0f4d9e.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libanyhow-fb7838929ab67b5b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtls_parser-14780e84989bd7dc.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libphf-15e890e202e822cc.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libphf_shared-da38f24dcb395d81.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsiphasher-4109af6f86bf27d9.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libenum_primitive-ffd6025359d71ba8.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnum_traits-6682e42ef240bf12.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/librusticata_macros-22fe164abc9b5b0b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libdhcp4r-91e266b0ad5e4bdd.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnom-6a596f739df36458.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/liblexical_core-d8989d57e03d1712.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libryu-64dce06faff9177b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libstatic_assertions-1cf41601918d89dc.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libarrayvec-88a110529c9083fc.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libbitvec-f2401cec1d306498.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libfunty-55f994380efe41c5.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libwyz-149bb82812acce89.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtap-dd207f7ce21663a9.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libradium-953be313d1a9dc2b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnum_traits-f09ed6493013efb2.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libenv_logger-81f824e4c9058204.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtermcolor-3537322170adc5a5.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libhumantime-6e983d77d498d5ea.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/liblog-d2dab3a6ca052573.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libregex-776e11026c6184d6.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libaho_corasick-76f2cdd78a01d9c2.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libregex_syntax-cc34ad437ed2329b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libpktparse-b305ab18af25786d.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libserde-40b54b7fb125bf41.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libnom-d8c565038a4d718d.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libminimal_lexical-c278fbf4782ca2f6.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsha2-f49ea05dd23f6c63.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libcpufeatures-cab6d3d94bb598d4.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libcfg_if-23cb98e16ba5841d.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libopaque_debug-224dfe0b90175c44.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libdigest-85b9bcd5f986e3e1.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libblock_buffer-3573700c45fc367f.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libgeneric_array-76e370859aadfbab.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtypenum-4db9a3482fc44427.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libreduce-e7a79a63611e94f5.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libbstr-8204b148110efbba.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libregex_automata-94540d315e7aec16.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libmemchr-2837751a30202fcb.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libansi_term-0b75e44c061c2ef1.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libstructopt-29596c91e2827dc2.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/liblazy_static-b8135df487646045.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libclap-3c319a3f938bf655.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libvec_map-07ba8c61b75c000d.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libtextwrap-93c08dd71e827c49.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libunicode_width-4b893a81a089af3b.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libstrsim-e355c483d783f5b9.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libbitflags-2a3c73b01af5e903.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libatty-8349e9daad0087a0.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/liblibc-d66410fb2703b7e5.rlib" "/usr/home/maxfx/Documents/sniffglue/target/debug/deps/libansi_term-67062a840ec62e67.rlib" "-Wl,--start-group" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-60484778edbab02a.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libpanic_unwind-dc2ae4d0a466e49f.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libminiz_oxide-4ffdbfe2ec17bf17.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libadler-c0c35bf5c8faaa12.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libobject-2f585d565898c512.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libaddr2line-c4981ba22728774a.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libgimli-53f3ea5ca1698b2e.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libstd_detect-ca404df982551ee0.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_demangle-6cc518f71c9c2316.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libhashbrown-df5cfc7c9e693ffe.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_alloc-05242e744576510b.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libunwind-9845119b8b6a2916.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libcfg_if-6c8ff242046b1c52.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/liblibc-85760c759f190965.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/liballoc-3a190eca975ddd7e.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_core-7525106f2a6b24a2.rlib" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libcore-4ee7510cd643b335.rlib" "-Wl,--end-group" "/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib/libcompiler_builtins-46641b4a03e19e40.rlib" "-Wl,-Bdynamic" "-lrt" "-lutil" "-lexecinfo" "-lutil" "-lprocstat" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-lutil"
  = note: ld: error: undefined symbol: pcap_create
          >>> referenced by sniff.rs:17 (src/sniff.rs:17)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open::h282e1377d6a42fc2) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_set_promisc
          >>> referenced by sniff.rs:25 (src/sniff.rs:25)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open::h282e1377d6a42fc2) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_set_immediate_mode
          >>> referenced by sniff.rs:29 (src/sniff.rs:29)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open::h282e1377d6a42fc2) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_activate
          >>> referenced by sniff.rs:32 (src/sniff.rs:32)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open::h282e1377d6a42fc2) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_geterr
          >>> referenced by sniff.rs:34 (src/sniff.rs:34)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open::h282e1377d6a42fc2) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_open_offline
          >>> referenced by sniff.rs:47 (src/sniff.rs:47)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::open_file::h6b536c1658bb4bce) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_lookupdev
          >>> referenced by sniff.rs:62 (src/sniff.rs:62)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::default_interface::h5f81dc2051d01a41) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_datalink
          >>> referenced by sniff.rs:74 (src/sniff.rs:74)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::Cap::datalink::h56ac48274576ae37) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_next_ex
          >>> referenced by sniff.rs:83 (src/sniff.rs:83)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(sniffglue::sniff::Cap::next_pkt::h791983a6c409863f) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib

          ld: error: undefined symbol: pcap_close
          >>> referenced by sniff.rs:106 (src/sniff.rs:106)
          >>>               sniffglue-bf1eb365f3317f48.sniffglue.9mn4iqw5-cgu.13.rcgu.o:(_$LT$sniffglue..sniff..Cap$u20$as$u20$core..ops..drop..Drop$GT$::drop::h99b326b0cef8db1a) in archive /usr/home/maxfx/Documents/sniffglue/target/debug/deps/libsniffglue-bf1eb365f3317f48.rlib
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `sniffglue`
kpcyrd commented 2 years ago

hi!

I don't have a freebsd system to test with, did you try deleting the target/ build folder after installing libpcap? This was the solution in #68 for a very similar error. :)

Thanks!

Martinfx commented 2 years ago

In new version is issue fixed. Thank you