LX0-103 · Question #159
To what environment variable will an administrator assign or append a value if the administrator needs to tell the dynamic linker to look in a build directory for some of a program's shared libraries?
The correct answer is C. LD_LIBRARY_PATH. LD_LIBRARY_PATH is the environment variable recognized by the Linux dynamic linker for locating shared libraries at runtime, allowing administrators to prepend a build directory to the default search path.
Question
To what environment variable will an administrator assign or append a value if the administrator needs to tell the dynamic linker to look in a build directory for some of a program's shared libraries?
Options
- ALD_LOAD_PATH
- BLD_LIB_PATH
- CLD_LIBRARY_PATH
- DLD_SHARE_PATH
- ELD_RUN_PATH
How the community answered
(47 responses)- B4% (2)
- C94% (44)
- E2% (1)
Why each option
LD_LIBRARY_PATH is the environment variable recognized by the Linux dynamic linker for locating shared libraries at runtime, allowing administrators to prepend a build directory to the default search path.
LD_LOAD_PATH is not a variable recognized by the Linux dynamic linker and has no effect on shared library resolution.
LD_LIB_PATH is not the correct variable name - the actual name requires the full word LIBRARY, so this misspelled variant is ignored by the dynamic linker.
LD_LIBRARY_PATH is parsed by the dynamic linker (ld.so/ld-linux.so) before the default system library paths such as /lib and /usr/lib. Setting it to a build directory instructs the linker to search there first when resolving shared library dependencies at program startup, which is the standard method for testing in-development libraries without a system-wide install.
LD_SHARE_PATH is not a valid environment variable recognized by the Linux dynamic linker and will not affect shared library searches.
LD_RUN_PATH is a build-time concept that can be embedded into a binary's RPATH by the linker, but it is not a runtime environment variable an administrator can set to redirect dynamic library searches.
Concept tested: Dynamic linker runtime shared library path variable
Source: https://man7.org/linux/man-pages/man8/ld.so.8.html
Topics
Community Discussion
No community discussion yet for this question.