Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking Problems on Raspbian #1

Open
dbrgn opened this issue Dec 3, 2020 · 0 comments
Open

Linking Problems on Raspbian #1

dbrgn opened this issue Dec 3, 2020 · 0 comments

Comments

@dbrgn
Copy link

dbrgn commented Dec 3, 2020

When compiling a project relying on pcap-sys (through pcap-async) on Raspbian 10, I get the following linker error:

  = note: /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `_ZN4core3ptr13drop_in_place17hb66f8f875e5d1dccE.llvm.13793024573420579538':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN4core3ptr13drop_in_place17hb66f8f875e5d1dccE.llvm.13793024573420579538+0x0): undefined reference to `pcap_freecode'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `pcap_async::handle::Handle::live_capture':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN10pcap_async6handle6Handle12live_capture17h6557f119a232aba6E+0x90): undefined reference to `pcap_create'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `pcap_async::handle::Handle::set_non_block':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN10pcap_async6handle6Handle13set_non_block17hf4e8a93926b9a91eE+0x1c): undefined reference to `pcap_setnonblock'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `pcap_async::handle::Handle::compile_bpf':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN10pcap_async6handle6Handle11compile_bpf17h1cbe29a65882b173E+0xac): undefined reference to `pcap_compile'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `<pcap_async::handle::Handle as core::ops::drop::Drop>::drop':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN68_$LT$pcap_async..handle..Handle$u20$as$u20$core..ops..drop..Drop$GT$4drop17h968f408f009ec3e5E+0x4): undefined reference to `pcap_close'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.3.rcgu.o): in function `_ZN10pcap_async9pcap_util21convert_libpcap_error17hcd135f13b535341dE.llvm.13793024573420579538':
          pcap_async.cf3bqvom-cgu.3:(.text._ZN10pcap_async9pcap_util21convert_libpcap_error17hcd135f13b535341dE.llvm.13793024573420579538+0x10): undefined reference to `pcap_geterr'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.5.rcgu.o): in function `pcap_async::stream::PacketStream::new':
          pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x30): undefined reference to `pcap_set_snaplen'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x98): undefined reference to `pcap_set_promisc'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0xf8): undefined reference to `pcap_set_buffer_size'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x154): undefined reference to `pcap_activate'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x310): undefined reference to `pcap_setfilter'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x344): undefined reference to `pcap_freecode'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.5:(.text._ZN10pcap_async6stream12PacketStream3new17h5bfa72491ecfb6d0E+0x378): undefined reference to `pcap_freecode'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.7.rcgu.o): in function `alloc::sync::Arc<T>::drop_slow':
          pcap_async.cf3bqvom-cgu.7:(.text._ZN5alloc4sync12Arc$LT$T$GT$9drop_slow17h9768855276503f6cE+0x10): undefined reference to `pcap_close'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.8.rcgu.o): in function `pcap_async::info::Info::all':
          pcap_async.cf3bqvom-cgu.8:(.text._ZN10pcap_async4info4Info3all17h276696d77238f1ceE+0x44): undefined reference to `pcap_findalldevs'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.14.rcgu.o): in function `<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll':
          pcap_async.cf3bqvom-cgu.14:(.text._ZN97_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h05bdbf0f35d924c7E+0x2e0): undefined reference to `pcap_dispatch'
          /usr/bin/ld: pcap_async.cf3bqvom-cgu.14:(.text._ZN97_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h05bdbf0f35d924c7E+0xd58): undefined reference to `pcap_breakloop'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.14.rcgu.o): in function `pcap_async::pcap_util::convert_libpcap_error':
          pcap_async.cf3bqvom-cgu.14:(.text._ZN10pcap_async9pcap_util21convert_libpcap_error17hcd135f13b535341dE+0x10): undefined reference to `pcap_geterr'
          /usr/bin/ld: /home/pi/sensilo/gateway/target/release/deps/libpcap_async-983d6e4b0207a9ad.rlib(pcap_async-983d6e4b0207a9ad.pcap_async.cf3bqvom-cgu.4.rcgu.o): in function `pcap_async::packet::future::PacketFuture::new':
          pcap_async.cf3bqvom-cgu.4:(.text._ZN10pcap_async6packet6future12PacketFuture3new17hb0caa3e86baa9d26E+0x1c): undefined reference to `pcap_get_selectable_fd'
          collect2: error: ld returned 1 exit status

The Debian package for libpcap0.8-dev doesn't seem to install a pkg-config file. The headers are here:

...
/usr/include/pcap/bluetooth.h
/usr/include/pcap/bpf.h
/usr/include/pcap/can_socketcan.h
/usr/include/pcap/dlt.h
/usr/include/pcap/export-defs.h
/usr/include/pcap/ipnet.h
/usr/include/pcap/namedb.h
/usr/include/pcap/nflog.h
/usr/include/pcap/pcap.h
/usr/include/pcap/sll.h
/usr/include/pcap/usb.h
/usr/include/pcap/vlan.h
/usr/include/pcap-bpf.h
/usr/include/pcap-namedb.h
/usr/include/pcap.h
...

The shared lib is located at /usr/lib/arm-linux-gnueabihf/libpcap.so and /usr/lib/arm-linux-gnueabihf/libpcap.so.0.8 and /usr/lib/arm-linux-gnueabihf/libpcap.so.1.8.1.

Any ideas how to debug and resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant