Having some issue with using libpcap in OpenWrt

Hi. I developed software that uses libpcap. I'm trying to build my software using toolchain(generated while building openwrt) to run in openwrt(raspberry pi 3 B). I installed libpcap to my system(openwrt, raspberry pi 3B) using opkg. After libpcap installed to my system I used /usr/lib/libpcap.so while building my software but ld throws error that functions(pcap_open_live, pcap_sendpacket, pcap_next_ex) in libpcap is undefined.

I checked that functions are defined in libpcap.so using readelf but I don't think is defined already.

root@OpenWrt:/usr/lib# readelf -sDw libpcap.so | grep -- "pcap_open_live\|pcap_next_ex\|pcap_sendpacket"
   90  52: 000000000000e1a0   360 FUNC    GLOBAL DEFAULT bad pcap_open_live
  114 143: 000000000000e12c    36 FUNC    GLOBAL DEFAULT bad pcap_sendpacket
  180 190: 000000000000c6c4    92 FUNC    GLOBAL DEFAULT bad pcap_next_ex

Is there any thing I can try or check to fix this?

1 Like

I soved it. I thought libpcap share object is fine but it's not. I cloned libpcap project from github and I builded myself using my toolchain.And I successfully built my software using new shared object.

Command what I used to build libpcap is this
CC=[toolchain gcc] ./configure --host=[architecture]-none-linux-gnuabi --prefix=/home/pol4bear/libpcap && make

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.