0

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
user138126
  • 953
  • 3
  • 14
  • 29

1 Answers1

1

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

yum install libpcap-devel.i686

nos
  • 223,662
  • 58
  • 417
  • 506
  • 1
    if a machine are with tcpdump, that machine doesn't necessarily have libpcap-devel, then can my program run on that machine? thanks! – user138126 Mar 25 '13 at 16:19
  • Yes, the -devel packages are for development, i.e. compiling and linking, and isn't needed at runtime. – nos Mar 25 '13 at 16:22