Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831912 - app-misc/pax-utils: lddtree applies main ELF's rpath to all children lookups
Summary: app-misc/pax-utils: lddtree applies main ELF's rpath to all children lookups
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
Depends on:
Reported: 2022-01-23 19:23 UTC by gogoprog
Modified: 2022-01-30 10:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description gogoprog 2022-01-23 19:23:51 UTC
I use `lddtree` on Arch Linux and I noticed the following issue:

`ldd` and `lddtree` results differ when modifying the libraries rpath.

So I have a project `Main` which depends on LibA which depends on LibB.

Then I screw the rpath:

patchelf *.so --set-rpath 'somethingwrong/'

Then notice the difference between the 2 outputs:

$ ldd Main                                                                                                                                                                       !10084 (0x00007ffcfabf7000) => /home/gogoprog/code/lddtreebug/build/ (0x00007f45217fc000) => /usr/lib/ (0x00007f45215bc000) => /usr/lib/ (0x00007f4521478000) => /usr/lib/ (0x00007f452145d000) => /usr/lib/ (0x00007f4521291000)
	/lib64/ => /usr/lib64/ (0x00007f4521808000) => not found

$ lddtree Main                                                                                                                                                                   !10085
Main (interpreter => /lib64/ => /home/gogoprog/code/lddtreebug/build/ => /home/gogoprog/code/lddtreebug/build/ => /usr/lib/ => /usr/lib/ => /usr/lib/ => /usr/lib/

The depending library `libB` is found with `lddtree` but should not.
It seems that `rpath` info is not used with `lddtree`.

These outputs are from Arch Linux. I did not test on Gentoo yet.

I made a repo here to reproduce:

Might be related to .
Comment 1 SpanKY gentoo-dev 2022-01-30 10:35:58 UTC
your custom patching isn't the issue.  cmake is applying -rpath to the main program and lddtree is using that to find not only its own libs, but dependencies of those libs.

to repro:
  gcc -x c - -fPIC -shared -o <<<''
  gcc -x c - -fPIC -shared -o -L. -lB <<<''
  gcc -x c - -o main -L. -lA -Wl,-rpath,$PWD <<<'int main(){}'
  ldd ./main
  lddtree ./main

will need to change lddtree to only apply rpath/runpath settings to the immediate linkage lookup rather than all children