tcpdump mailing list archives

Re: libpcap detection and linking in tcpdump


From: Guy Harris via tcpdump-workers <tcpdump-workers () lists tcpdump org>
Date: Fri, 22 Jan 2021 19:11:16 -0800

--- Begin Message --- From: Guy Harris <gharris () sonic net>
Date: Fri, 22 Jan 2021 19:11:16 -0800
On Jan 22, 2021, at 2:54 PM, Denis Ovsienko via tcpdump-workers <tcpdump-workers () lists tcpdump org> wrote:

I have tested it again with the current master branches of libpcap and
tcpdump. Both builds (with and without libpcap0.8-dev) now complete
without errors.

However, in both cases the installed tcpdump fails to run because it
is linked with libpcap.so.1. Which, as far as I can remember,
previously somehow managed to resolve to the
existing /tmp/libpcap/lib/libpcap.so.1, but not amymore:

$ /tmp/libpcap/bin/tcpdump --version
/tmp/libpcap/bin/tcpdump: error while loading shared libraries:
libpcap.so.1: cannot open shared object file: No such file or directory

$ ldd /tmp/libpcap/bin/tcpdump
      linux-vdso.so.1 (0x00007ffdc7ffe000)
      libpcap.so.1 => not found
      libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
(0x00007f34522ac000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
(0x00007f3451ebb000)
      libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
(0x00007f3451cb7000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f3451a98000)
      /lib64/ld-linux-x86-64.so.2 (0x00007f3452c6f000)

$ /tmp/libpcap/bin/pcap-config --libs
-L/tmp/libpcap/lib -Wl,-rpath,/tmp/libpcap/lib -lpcap

So that *should* cause /tmp/libpcap/lib to be added to the executable's path, which *should* cause it to look in 
/tmp/libpcap/lib for shared libraries.

So, if there's a /tmp/libpcap/lib/libpcap.so.1 file, that's not happening, somehow.

I'll try experimenting with one of my Ubuntu VMs.

In the meantime, for some fun head-exploding reading, take a look at

        https://en.wikipedia.org/wiki/Rpath

and perhaps some other documents found by a search for

        lpath rpath linux

--- End Message ---
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Current thread: