Which of these commands allows you to use shared libraries that are in /usr/local/lib?

Which of these commands allows you to use shared libraries that are in /usr/local/lib?

Which of these commands allows you to use shared libraries that are in /usr/local/lib?

A.
export LD_PRELOAD=/usr/local/lib

B.
export LD_LIBRARY_PATH=/usr/local/lib

C.
ldconfig /usr/local/lib

D.
ldd /usr/local/lib

Explanation:
From the man pages:
ldconfig creates, updates, and removes the necessary links and cache (for use by the run-time linker,
ld.so) to the most recent shared libraries found in the directories specified on the command line, in
the file /etc/ld.so. conf, and in the trusted directories (/usr/lib and /lib). ldconfig checks the header
and file names of the libraries it encounters when determining which versions should have their links
updated. ldconfig ignores symbolic links when scanning for libraries.
ldd – print shared library dependencies
LD_PRELOAD – a whitespace-separated list of additional, user-specified, ELF shared libraries to be
loaded before all others. This can be used to selectively override functions in other shared libraries.
For set-user-ID/ set-group-ID ELF binaries, only libraries in the standard search directories that are
also set-user-ID will be loaded.
LD_LIBRARY_PATH – a colon-separated list of directories in which to search for ELF libraries at
executiontime.
Similar to the PATH environment variable



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Micha

Micha

Well, what does “use” mean? Seting LD_LIBRARY_PATH will use libs there too.

barney

barney

ldconfig –help
Usage: ldconfig [OPTION…]

there is no ldconfig file

Krisitan Kirilov

Krisitan Kirilov

-n Only process directories specified on the command line. Don’t build cache.

Maybe where is a missing -n flag in the answer.