[poppler] rpath - was - Re: cmake CXXFLAGS

Michael Stahl mstahl at redhat.com
Tue Sep 12 15:22:25 UTC 2017


On 11.09.2017 13:31, Albert Astals Cid wrote:
> El dilluns, 11 de setembre de 2017, a les 20:52:31 CEST, Adrian Johnson va 
> escriure:
>> On 11/09/17 20:28, Albert Astals Cid wrote:
>>> El diumenge, 10 de setembre de 2017, a les 20:39:18 CEST, Adrian Johnson 
> va escriure:
>>>> One more problem I found with cmake. It does not set up the rpath for
>>>> the install directory like autotools does. I sometimes have more than
>>>> one version of poppler installed to different prefixes for testing
>>>> purposes. With autotools I could just run any version without needing to
>>>> change LD_LIBRARY_PATH for the version I want to run.
>>>
>>> Don't touch LD_LIBRARY_PATH at all, it already does what you want.
>>>
>>> tsdgeos at xps:~/devel/poppler/build-new:master$ ldd utils/pdfinfo | grep
>>> poppler> 
>>>         libpoppler.so.70 =>
>>>         /home/tsdgeos/devel/poppler/build-new/libpoppler.so.70
>>>         (0x00007fc473d96000)> 
>>> tsdgeos at xps:~/devel/poppler/build-new:master$ cd ..
>>> tsdgeos at xps:~/devel/poppler:master$ cd build-old/
>>> tsdgeos at xps:~/devel/poppler/build-old:master$ ldd utils/pdfinfo | grep
>>> poppler> 
>>>         libpoppler.so.70 =>
>>>         /home/tsdgeos/devel/poppler/build-old/libpoppler.so.70
>>>         (0x00007f6d96bdd000)
>> Not after it has been installed.
>>
>> ~/usr/bin$ ldd ./pdfinfo  | grep poppler
>>         libpoppler.so.70 => not found
>>
>> autotools sets the rpath to the install directory.

this, btw, is a PITA for any ISV who wants to create relocatable
packages... they could just use $ORIGIN instead for the same effect,
but, well, autotools.

> This may be a silly question, but why do you need to install multiple 
> versions, just have different build dirs?
> 
> rpath is evil since AFAIR it wins against LD_LIBRARY_PATH, *I* want to have 
> the last word.

there are 2 different ELF flags that "ld -rpath" can set: DT_RPATH and
DT_RUNPATH

LD_LIBRARY_PATH overrides DT_RUNPATH but not DT_RPATH - that's why ld.so
manual says DT_RPATH is deprecated.

unfortunately contemporary ld will still generate DT_RPATH by default,
unless you tell ld to use DT_RUNPATH with "--enable-new-dtags".

as you would expect, GNU libtool doesn't know about --enable-new-dtags.


More information about the poppler mailing list