Search code examples
clinuxtcpdump

libpcap: 64bit machine has no compatible 32-bit libpcap library


I want to compile a .c file to 32-bit executable using gcc option -m32 with libpcap the machine is linux 64bit fedora 16

however, I get the following error

[root@fdf source]# gcc -m32 -o test_tcp test_tcp.c -lpcap
/usr/bin/ld: skipping incompatible /usr/lib64/libpcap.so when searching for -lpcap
/usr/bin/ld: cannot find -lpcap
 collect2: ld returned 1 exit status

I installed

 yum install libpcap.i686

and then try to compile, but still get errors:

root@ddh-4.0# gcc -m32 -o test_tcp test_tcp.c -lpcap
/usr/bin/ld: skipping incompatible /usr/lib64/libpcap.so when searching for -lpcap
/usr/bin/ld: cannot find -lpcap

Solution

  • You need the development package in addition to the runtime library. So do

    yum install libpcap-devel.i686