LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   libpcap-1.0.0 installation problem (https://www.linuxquestions.org/questions/linux-networking-3/libpcap-1-0-0-installation-problem-710469/)

charlotte01 03-10-2009 08:04 AM

libpcap-1.0.0 installation problem
 
"]
Hello,everyone, can you help me ?
I have some problems in the installation of libpcap-1.0.0,

os@os-desktop:~/final/libpcap-1.0.0$ sudo make install
[ -d /usr/local/lib ] || \
(mkdir -p /usr/local/lib; chmod 755 /usr/local/lib)
/usr/bin/install -c -m 644 libpcap.a /usr/local/lib/libpcap.a
ranlib /usr/local/lib/libpcap.a
[ -d /usr/local/include ] || \
(mkdir -p /usr/local/include; chmod 755 /usr/local/include)
[ -d /usr/local/include/pcap ] || \
(mkdir -p /usr/local/include/pcap; chmod 755 /usr/local/include/pcap)
[ -d /usr/local/share/man/man1 ] || \
(mkdir -p /usr/local/share/man/man1; chmod 755 /usr/local/share/man/man1)
[ -d /usr/local/share/man/man3 ] || \
(mkdir -p /usr/local/share/man/man3; chmod 755 /usr/local/share/man/man3)
[ -d /usr/local/share/man/man5 ] || \
(mkdir -p /usr/local/share/man/man5; chmod 755 /usr/local/share/man/man5)
[ -d /usr/local/share/man/man7 ] || \
(mkdir -p /usr/local/share/man/man7; chmod 755 /usr/local/share/man/man7)
/usr/bin/install -c -m 644 ./pcap/pcap.h \
/usr/local/include/pcap/pcap.h
/usr/bin/install -c -m 644 ./pcap/bpf.h \
/usr/local/include/pcap/bpf.h
/usr/bin/install -c -m 644 ./pcap/namedb.h \
/usr/local/include/pcap/namedb.h
/usr/bin/install -c -m 644 ./pcap/sll.h \
/usr/local/include/pcap/sll.h
/usr/bin/install -c -m 644 ./pcap/usb.h \
/usr/local/include/pcap/usb.h
/usr/bin/install -c -m 644 ./pcap.h /usr/local/include/pcap.h
/usr/bin/install -c -m 644 ./pcap-bpf.h \
/usr/local/include/pcap-bpf.h
/usr/bin/install -c -m 644 ./pcap-namedb.h \
/usr/local/include/pcap-namedb.h
/usr/bin/install -c pcap-config /usr/local/bin/pcap-config
for i in pcap-config.1; do \
/usr/bin/install -c -m 644 ./$i \
/usr/local/share/man/man1/$i; done
for i in pcap_activate.3pcap pcap_breakloop.3pcap pcap_can_set_rfmon.3pcap pcap_close.3pcap pcap_create.3pcap pcap_datalink_name_to_val.3pcap pcap_datalink_val_to_name.3pcap pcap_dump.3pcap pcap_dump_close.3pcap pcap_dump_file.3pcap pcap_dump_flush.3pcap pcap_dump_ftell.3pcap pcap_file.3pcap pcap_fileno.3pcap pcap_findalldevs.3pcap pcap_freealldevs.3pcap pcap_freecode.3pcap pcap_free_datalinks.3pcap pcap_get_selectable_fd.3pcap pcap_geterr.3pcap pcap_inject.3pcap pcap_is_swapped.3pcap pcap_lib_version.3pcap pcap_lookupdev.3pcap pcap_lookupnet.3pcap pcap_loop.3pcap pcap_major_version.3pcap pcap_next_ex.3pcap pcap_offline_filter.3pcap pcap_open_live.3pcap pcap_set_buffer_size.3pcap pcap_set_datalink.3pcap pcap_set_promisc.3pcap pcap_set_rfmon.3pcap pcap_set_snaplen.3pcap pcap_set_timeout.3pcap pcap_setdirection.3pcap pcap_setfilter.3pcap pcap_setnonblock.3pcap pcap_snapshot.3pcap pcap_stats.3pcap pcap_statustostr.3pcap pcap_strerror.3pcap pcap.3pcap pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap pcap_list_datalinks.3pcap pcap_open_dead.3pcap pcap_open_offline.3pcap; do \
/usr/bin/install -c -m 644 ./$i \
/usr/local/share/man/man3/$i; done
ln /usr/local/share/man/man3/pcap_datalink_val_to_name.3pcap \
/usr/local/share/man/man3/pcap_datalink_val_to_description.3pcap
ln /usr/local/share/man/man3/pcap_dump_open.3pcap \
/usr/local/share/man/man3/pcap_dump_fopen.3pcap
ln /usr/local/share/man/man3/pcap_geterr.3pcap \
/usr/local/share/man/man3/pcap_perror.3pcap
ln /usr/local/share/man/man3/pcap_inject.3pcap \
/usr/local/share/man/man3/pcap_sendpacket.3pcap
ln /usr/local/share/man/man3/pcap_loop.3pcap \
/usr/local/share/man/man3/pcap_dispatch.3pcap
ln /usr/local/share/man/man3/pcap_major_version.3pcap \
/usr/local/share/man/man3/pcap_minor_version.3pcap
ln /usr/local/share/man/man3/pcap_next_ex.3pcap \
/usr/local/share/man/man3/pcap_next.3pcap
ln /usr/local/share/man/man3/pcap_open_offline.3pcap \
/usr/local/share/man/man3/pcap_fopen_offline.3pcap
ln /usr/local/share/man/man3/pcap_setnonblock.3pcap \
/usr/local/share/man/man3/pcap_getnonblock.3pcap
for i in pcap-savefile.manfile.in; do \
/usr/bin/install -c -m 644 ./`echo $i | sed 's/.manfile.in/.manfile/'` \
/usr/local/share/man/man5/`echo $i | sed 's/.manfile.in/.5/'`; done
for i in pcap-filter.manmisc.in pcap-linktype.manmisc.in; do \
/usr/bin/install -c -m 644 ./`echo $i | sed 's/.manmisc.in/.manmisc/'` \
/usr/local/share/man/man7/`echo $i | sed 's/.manmisc.in/.7/'`; done

I thought libpcap is installed successfully,but when I tried to test it I got this:
os@os-desktop:~$ gcc -o device device.c -lpcap
/usr/bin/ld: skipping incompatible /usr/local/lib/libpcap.a when searching for -lpcap
/usr/bin/ld: cannot find -lpcap
collect2: ld returned 1 exit status
[/SIZE][/B][/B]

knudfl 03-10-2009 10:04 AM

Welcome to LQ.

It seems, that you only made the static lib, libpcap.a .

So when 'ld' is looking for libpcap.so or what ever the
'so' name is, nothing is found.

Try with libpcap again : ./configure --help .
Look for an option like : --enable-shared
and use it to create the shared libs = libpcap.so, etc.
.....
And please edit your post to "normal" letters, oversized
text is not very readable.
And please use code tags ...
http://www.linuxquestions.org/questi....php?do=bbcode
.....

charlotte01 03-11-2009 06:58 AM

Another problem
 
The problem with libpcap installation might be solved because the test was OK,but when I tried to install hafiye-1.0 , it's came to:

os@os-desktop:~/final/hafiye-1.0$ make
cc -o hafiye -g Data.o Infra.o Cfg.o Sniff.o Packet.o main.o /usr/lib/libpcap.a
/usr/bin/ld: /usr/lib/libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 40)
/usr/bin/ld: /usr/lib/libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 40)
/usr/lib/libpcap.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [all] Error 1

knudfl 03-11-2009 03:30 PM

Not knowing your system ( Fedora -version, Ubuntu -version
Suse -version......... etc.) makes it difficult to give the right
advise, but how about installing the 'libpcap' +
'libpcap-dev(el)' with your package manager ? ?
.....
So which "Linux" are you using ?
.....

knudfl 03-14-2009 04:33 AM

The very old 'hafiye-1.0' ( it's from year 2002 )
will compile with no problems using libpcap-0.9.8 or similar.
( You may have used the latest = 1.0.0 ).

But it will fail by linking on 'any newer Linux' because of :
Code:

/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in Data.o
So you will have to look for another "TCP/IP packet sniffer".
.....

charlotte01 03-15-2009 04:34 AM

Thank you for explaining the problem.I tried to install tcpdump-4.0.0 but came to the same problem:

os@os-desktop:~/final/tcpdump-4.0.0$ make
...
...
./../libpcap-1.0.0/libpcap.a(savefile.o): In function `pcap_dump_ftell':
savefile.c:(.text+0xe0): multiple definition of `pcap_dump_ftell'
pcap_dump_ftell.o:pcap_dump_ftell.c:(.text+0x0): first defined here
/usr/bin/ld: ./../libpcap-1.0.0/libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./../libpcap-1.0.0/libpcap.a(pcap-linux.o): Relocations in generic ELF (EM: 40)
./../libpcap-1.0.0/libpcap.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [tcpdump] Error 1

So I think it's not the "version problem".
P.S: OS is Ubuntu 7.10.

knudfl 03-15-2009 05:06 AM

Suggest : Remove ( or hide away ) all libpcap-1.0.0 .

And install the system version, with
'sudo apt-get install libpcap-dev'
( if Ubuntu Dapper 7.10 is still supported )
or get the packages here
http://packages.ubuntu.com/dapper/libpcap-dev
http://packages.ubuntu.com/dapper/libpcap0.7
.....

As mentioned in post # 5, an older version will
probably work. Do not use any newer than 0.9.8 !
The system version = 0.7.2 should be fine.
.....


All times are GMT -5. The time now is 12:16 AM.