Cplusplus Programmer wrote:
> I want to make a C++ program which needs also a few share libraries (.so
> files). My libraries I want to put for example in a directory
By convention if you are placing files in your $HOME directory then
these would be considered a personal installation just for you. In
which case you would typically set LD_LIBRARY_PATH to include that
directory. For details see:
> Where do I need to put the path to my libraries so that it can be
> found by the program.
> I have seen that I can use ld.so.conf.
Using ld.so.conf would be for system level installed files. That
would be files installed into /usr/lib, /usr/local, or other such
system location. Sure you can poing that into your home directory too
but that would be considered dirty. You would be mixing a personal
installation with a system installation. I would frown on that.
For details see:
> But I was wondering what the difference is between ld.so.conf and
> ld.so.conf.d. Why is ld.so.conf.d needed if we already have
> ls.so.conf ?
The ld.so.conf is a single file. It is easy for a human to edit a
single file such as that but it is hard for a program to do so. It is
easier for packaged programs to install a separate package specific
file in /etc/ld.conf.d/packagename so that it is simply installed when
the package is installed and removed when the package is uninstalled.
That is a clean interface for programs and packages. It is also
available to humans to of course.
> Is it possible to remove the ls.so.conf and put only files to the
> ld.so.conf directory ?
You would at the least need the include statement in /etc/ld.so.conf
to include the files from the ld.so.conf.d/*.conf or they would not be
> Is the ld.so.conf file really needed ?
It is used by ldconfig.
> I ask this because I saw on a machine with debian linux that I could
> not find the ld.so.conf file, but I do find the ls.so.conf.d
> directory with *.conf files in it. Does ldconfig automatically go
> through all .conf files in the /etc/ld.so.conf.d directory ?
AFAIK the ld.so.conf file is required for ldconfig. Please see the
ldconfig documentation for details.
In your case without that file it probably still had those other
directories in the /etc/ld.so.cache file.