badnack
badnack

Reputation: 767

Querying ld to find out where it is a shared library

I'd want to query the GNU linker (ld) in order to find out the path of a .so file. I know that there are several directories where such a files are stored, but I would know if it is possible to do that directly querying the linker.

What is it, if any, the right way to do that?

Upvotes: 0

Views: 159

Answers (1)

keltar
keltar

Reputation: 18389

Not direct query, but you could use something like

ld -t -lm -lc -lfoo 2> /dev/null | tail -n+2 | sed 's!^[^/]*\(/[^)]*\).*$!\1!g'

It will list all libraries passed to ld.

Upvotes: 1

Related Questions