1

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.

Community
  • 1
  • 1
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271

1 Answers1

4

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'
Dark Falcon
  • 43,592
  • 5
  • 83
  • 98