LFCS · Question #705
You are preparing a new set of shared libraries in /usr/local/applib and you have written and compiled some code that uses these libraries. You have already performed an Idconfig, however the system…
The correct answer is D. You forgot to put the library path in ld.so.conf. If new shared libraries are not found after running ldconfig, it is most likely because their path was not added to the ld.so.conf configuration file, which informs the dynamic linker how to locate shared libraries.
Question
Options
- AYou used the wrong compil|er.
- BYou did not update your PATH variable.
- CYou compiled the code with wrong library.
- DYou forgot to put the library path in ld.so.conf.
How the community answered
(22 responses)- A5% (1)
- B5% (1)
- C14% (3)
- D77% (17)
Why each option
If new shared libraries are not found after running `ldconfig`, it is most likely because their path was not added to the `ld.so.conf` configuration file, which informs the dynamic linker how to locate shared libraries.
Using the wrong compiler would typically lead to compilation errors or incorrect executable behavior, not an inability of the system to *find* shared libraries at runtime if they are correctly installed.
The `PATH` variable is used by the shell to locate executable programs, not by the dynamic linker to find shared libraries; library paths are managed by `ldconfig` and `LD_LIBRARY_PATH`.
Compiling with the wrong library would likely result in link-time errors or incorrect program behavior, but the system's dynamic linker would still be able to *find* other shared libraries it has configured.
The `ldconfig` utility builds the necessary links and cache for the dynamic linker. It relies on paths specified in `/etc/ld.so.conf` and directories like `/lib` and `/usr/lib` by default. If a custom library path like `/usr/local/applib` is not explicitly added to `/etc/ld.so.conf` (or a file within `/etc/ld.so.conf.d/`), `ldconfig` will not include those libraries in its cache, causing the system to fail to find them.
Concept tested: Linux dynamic linker configuration
Source: https://man7.org/linux/man-pages/man8/ldconfig.8.html
Topics
Community Discussion
No community discussion yet for this question.