tcpdump mailing list archives

Cannot find -lpcap when statically compiling a C project


From: liu wen <caonimagongling () gmail com>
Date: Fri, 20 Nov 2015 00:29:22 +0100

I want to statically compile a C project in a laptop(fedora), using command
line like:

gcc -o myprogram -static main.c ... -levent -lpcap

but I get error:

/usr/bin/ld: cannot find -lpcap
/usr/bin/ld: cannot find -lc

I tried to locate libpcap.a and find no such a file

if I compile dynamically, it successfully produces an executable

ldd relay
linux-vdso.so.1 => (0x00007fff4bfaf000)
libevent-1.4.so.2 => /lib/libevent-1.4.so.2 (0x00007f14053a5000)
libpcap.so.1 => /lib64/libpcap.so.1 (0x00000035b4a00000)
libc.so.6 => /lib64/libc.so.6 (0x00000035b0a00000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00000035cea00000)
librt.so.1 => /lib64/librt.so.1 (0x00000035b1a00000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00000035b2e00000)
/lib64/ld-linux-x86-64.so.2 (0x00000035b0200000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035b1600000)


This executable only works in this laptop. If I compile the project in
other laptops, it doesn't work properly(the libpcap can't capture all
packets successfully, I don't know why). So I think the libpcap in this
laptop may plays an important role and this is why I really want to compile
it statically in this laptop.

Are there anyways for me to statically compile in this very laptop. Or how
can I find the libpcap.a on Internet with the same version?
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: