You are not logged in.

#1 2015-03-31 11:06:05

spikeh
Member
Registered: 2012-04-14
Posts: 33

Preserving custom library path when installing an AUR package

Hello, I'm trying to install Bro from the AUR to use a custom libpcap compiled with PF_RING support by using a configuration flag `--with-pcap=/opt/pfring'. Specifics aside, when I call `ldd' after compiling with `makepkg' I get:

libpcap.so.1 => /opt/pfring/lib/libpcap.so.1 (0x00007fbd41eb5000)

But after I install using `pacman -U', I get:

libpcap.so.1 => /usr/lib/libpcap.so.1 (0x00007f9151973000)

I think something is happening when I install with pacman. Can I avoid setting LD_LIBRARY_PATH by making pacman preserve the custom library path?


Thinkpad T420

Offline

#2 2015-03-31 11:11:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: Preserving custom library path when installing an AUR package

spikeh wrote:

...a custom libpcap compiled with PF_RING support by using a configuration flag `--with-pcap=/opt/pfring'. Specifics aside...

We need more of the specifics.  Where is this PKGBUILD for this custom libpcap?  It sounds like that's where the problem is: either in the PKGBULD's package function, or perhaps in a patched Makefile with the install directive overridden.

EDIT: perhaps I misunderstood - was this upon installing your libpcap package, or the Bro package?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2015-03-31 11:29:50

spikeh
Member
Registered: 2012-04-14
Posts: 33

Re: Preserving custom library path when installing an AUR package

I first install libpcap, then Bro.

I am manually compiling and installing libpcap with PF_RING support to /opt/pfring:

$ cd PF_RING/userland/libpcap
$ ./configure --prefix=/opt/pfring
$ sudo make install

I then download the AUR tarball for Bro. I edit the PKGBUILD to add `--with-pcap=/opt/pfring' to line 31:

./configure --prefix="/usr" --conf-files-dir="/etc/bro" --with-pcap=/opt/pfring --with-python=/usr/bin/python2

After compiling with `makepkg -s':

$ cd src/bro/build/src
$ ldd ./bro
...
libpcap.so.1 => /opt/pfring/lib/libpcap.so.1 (0x00007fa198812000)
...

After installing the package using `pacman -U':

$ whereis bro
bro: /usr/bin/bro /usr/lib/bro /etc/bro /usr/share/bro /usr/share/man/man8/bro.8.gz
$ ldd /usr/bin/bro
...
libpcap.so.1 => /usr/lib/libpcap.so.1 (0x00007f05be4c6000)
...

Should I write a PKGBUILD for the custom libpcap?


Thinkpad T420

Offline

#4 2015-03-31 14:51:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: Preserving custom library path when installing an AUR package

My apologies - I did misunderstand the first time around.  But the information above should be useful just the same.

I don't have a good understanding of how the linker/loader picks its targets, so consider the following speculation and brainstorming - but I see a few ways to investigate.

First, do you have the regular libpcap installed?  If so, this might be part of the issue - if the library is already loaded, the linker/loader would use the loaded/cached version rather than the alternative.  This, however, would not explain why ldd gives different output before and after installing - but if it would not interfere with anything else, you could use your customized libpcap as a replacement for the one from the repos and have it install to /usr as normal - this would defintely avoid the current issue.

Second, when building the package, makepkg does a few things to the binaries that might affect this.  Most notably is the stripping of symbols.  I thought this only stripped exported symbols, and I don't know if/why it would affect the library search path, but as you get different ldd output with the built and installed binaries, I'd try disabling the strip option at least as a diagnostic test.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB