On Nov 19, 2015, at 4:35 PM, liu wen <caonimagongl...@gmail.com> wrote:

> On Fri, Nov 20, 2015 at 12:52 AM, Guy Harris <g...@alum.mit.edu> wrote:
> 
>> On Nov 19, 2015, at 3:29 PM, liu wen <caonimagongl...@gmail.com> wrote:
>> 
>>> 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
>> 
>> See if there are libpcap RPMs that you haven't installed, perhaps one with a 
>> name like "libpcap-dev" or something with "-dev" in the name, although 
>> usually "-dev" packages include both static libraries and header files, so 
>> without the "-dev" package you won't be able to compile anything.  Perhaps 
>> Fedora has separate packages for the libpcap runtime (shared libraries), 
>> libpcap development (headers), and libpcap static libraries.
> 
> # locate libpcap-dev
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/changed_by
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/checksum_data
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/checksum_type
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/command_line
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/from_repo
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/from_repo_revision
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/from_repo_timestamp
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/installed_by
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/reason
> /var/lib/yum/yumdb/l/75ed44a0adeee36906852424e93dafd3a950ae77-libpcap-devel-1.3.0-2.fc18-x86_64/releasever
> 
> what commands/steps should I follow so as to get the libpcap.a?

You might have to build it from source, because the Fedora people don't like 
static libraries:

        
https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries

        https://bugzilla.redhat.com/show_bug.cgi?id=248813

>> However, "cannot find -lc" means it also doesn't have a static version of 
>> libc, so you'll also have to find a Fedora package with a static version of 
>> libc.
> 
> how can I find a static version of libc?

You might have to build it from source, because the Fedora people don't like 
static libraries.

However, they might have decided to allow a static version of libc:

        http://www.xinotes.net/notes/note/1025/

If that works, try looking for a libpcap-static package, but there might not be 
one.
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to