LFCS practice question 4 of 35

Which of the following environment variables overrides or extends the list of directories holding shared libraries?

Full set: 260 questions
Answer options
A: LD_LOAD_PATH
B: LD_LIB_PATH
C: LD_LIBRARY_PATH Correct answer
D: LD_SHARE_PATH
E: LD_RUN_PATH
Correct Answer:
C. LD_LIBRARY_PATH
Explanation

The LDLIBRARYPATH environment variable contains a colon-separated list of directories. The dynamic linker (ld.so) will search these directories for required shared libraries before searching the standard locations specified in /etc/ld.so.conf and the executable's own runpath. This allows users to temporarily override system libraries or test new library versions without altering the system's configuration. It is a powerful tool for development and debugging but should be used with caution in production environments due to its potential to create library conflicts.

Why Incorrect

A. LDLOADPATH is not a standard environment variable used by the dynamic linker in Linux for this purpose.
B. LDLIBPATH is not the correct name for the standard environment variable used by the Linux dynamic linker.
D. LDSHAREPATH is not a standard environment variable used by the dynamic linker for locating shared libraries.
E. LDRUNPATH is a link-time environment variable used to embed a library search path directly into an executable.

References

1. The Linux man-pages project. (2021). ld.so(8) — Linux manual page. "LDLIBRARYPATH: A list of directories in which to search for ELF libraries at execution time. The items in the list are separated by colons or semicolons."

2. Ulrich Drepper. (2006). How To Write Shared Libraries. Section 3.1, "The Dynamic Linker". "The user can influence the behavior of the dynamic linker by setting the environment variable LDLIBRARYPATH."

Scroll to Top