Search code examples
linuxubuntulinkersystem-administrationsystem-paths

In Ubuntu (14.04), is there an equivalent to /etc/ld.so.conf.d for the linker?


This is a question about centrally-located path specs, like PATH, LD_LIBRARY_PATH, and LIBRARY_PATH.

I know that there are two ways of specifying shared library paths for the loader: add them to LD_LIBRARY_PATH, or add files to /etc/ld.so.conf.d/. I also know that the latter is considered the more modern and preferred way to do it.

I also know that you can specify standard library paths for the linker by editing LIBRARY_PATH. Is this still the "modern" way to do it, or is there now a "ld.so.conf.d-style" alternative that I should be using?

EDIT: People are asking "why", so:

I'm using a Python package (Theano) that dynamically generates and compiles CUDA and C++ code when run. One of the libraries it links to is NVidia's cuDNN. I don't know why Theano's developer's have it link to the static lib and not the dynamic lib.


Solution

  • There isn't any equivalent to ld.so.conf.d/ for static libraries. You still just specify the standard linker search paths via the LIBRARY_PATH environment variable, and additional paths through command-line flags to the linker.

    To be clear:

    • LIBRARY_PATH: Used by the linker at compile time. Is used by the linker to find both static and dynamic libraries.
    • LD_LIBRARY_PATH: Used by the loader at run time to find dynamic libraries.