0

I am running centos 6.10 in docker. As is described in the title, I set /usr/local/lib and /usr/local/lib64 in a conf file in /etc/ld.so.conf.d/. I need to run ldconfig everytime when I put .so library into /usr/local/lib or it will not be found (when compiling Python 3). However, setting LD_LIBRARY_PATH to /usr/local/lib:/usr/local/lib64 (without writing them to conf files in /etc/ld.so.conf.d/) does not need any additional steps after putting the libs. What causes this?

By the way, why directories like /lib and /usr/lib are not set in /etc/ld.so.conf or /etc/ld.so.conf.d/?

Steven Yang
  • 423
  • 1
  • 8
  • 15

1 Answers1

0

When an app is run via LD_LIBRARY_PATH=PATH app glibc will scan all the files in the the specified directories.

When you're not using this flag only cached libraries (/etc/ld.so.cache) are opened to speed up the process. Imagine you need to run a certain application 100K times in a row and each time all the directories have to be rescanned. It might slow everything to a crawl.

Artem S. Tashkinov
  • 26,392
  • 4
  • 33
  • 64