Trevor Hickey
Trevor Hickey

Reputation: 37836

Without admin prevlieges, how do I find the directories searched by ld?

How do I find the directories searched in by the GNU linker, without admin privileges?


I can get the listing in the following way:

$ sudo ldconfig -v 2>/dev/null | grep -v ^$'\t'
/lib/i386-linux-gnu:
/usr/lib/i386-linux-gnu:
/usr/local/lib:
/lib/x86_64-linux-gnu:
/usr/lib/x86_64-linux-gnu:
/usr/lib/fglrx:
/usr/lib32/fglrx:
/lib32:
/usr/lib32:
/lib:
/usr/lib:
/usr/lib/i386-linux-gnu/sse2: (hwcap: 0x0000000004000000)

this solution came from: How to print the ld(linker) search path


However, on a machine where I do not have admin privileges, this will not work. I assume that’s because ldconfig is located in /sbin/. I download glibc and installed it locally to create another version of ldconfig. I guess that was silly though because the local version gives me:

/usr/local/lib:
/usr/local/lib64:

Is it still possible to get all the directories as a non-admin?
There doesn't appear to be any helpful ld flags, or environment variables to do the job.

Upvotes: 1

Views: 199

Answers (1)

Dark Falcon
Dark Falcon

Reputation: 44181

Just because ldconfig is in sbin doesn't mean it can't be run as a normal user. Simply use that command and specify the full path to ldconfig:

/sbin/ldconfig -v 2>/dev/null | grep -v ^$'\t'

Upvotes: 4

Related Questions