简体   繁体   中英

Libpcap not found when cross-compiling 32-bit on a 64-bit Debian

I am trying to compile a 32-bit application on 64-bit Debian Stretch. I have compiled several other applications successfully this way, but one app that uses the pcap library is giving me problems. There does not seem to be a 32-bit version of this library anywhere for my platform.

Problem description

When I try to link my application, like this:

g++ (...objectfiles-and-options...) -m32 -o myapp -lpthread -lpcap

I get the error

/usr/bin/ld: cannot find -lpcap

I checked, and there is indeed no libpcap.so (or variant thereof) in /usr/lib32. However, all other libraries I am using is present there (like libpthread). I tried to create soft-links to the 64-bit pcap-libraries in there, just in case they should be multi-platform compatible, but that only resulted in "skipping incompatible /usr/lib32/libpcap.so when searching for -lpcap".

I've installed libpcap-dev, libc6-dev-i386, gcc-multilib and g++-multilib (obviously, since cross-compilation works fine for all applications that does not use libpcap). I would suspect there should be a libpcap-dev-i386 I could install, but there does not seem to be one.

Perhaps I should mention that the application compiles and links successfully as 64 bit.

Does anyone know what I am missing here?

You can compile libpcap yourself. It's probably the better solution than depending on packages. Use configure for 32bit architecture and than give your compiler LDFLAGS pointing to your lib or install it in /usr/lib32/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM