0

I want to get the libraries paths of system installed libpcap with gcc, so I can copy it to another machine to cross compile my program that use libpcap.

1 Answer 1

1

write an empty c source file into /tmp/1.c

int main(){} 

run the command line

gcc -Wl,-t -lpcap /tmp/1.c 

You will see a line looks like following in ubuntu 2004

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpcap.so 

or a line looks like following in mac os

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libpcap.tbd 

Ps1, when you use libpcap-dev in ubuntu 2004, you need two kind of files to make the compile works:

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpcap.so /usr/include/pcap.h 

Ps2, if you want to know where the .h file is location, see https://stackoverflow.com/a/18593344/1586797

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.