LX0-103 · Question #105
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. After placing shared libraries in a custom directory, ldconfig must be told where to look by adding the path to /etc/ld.so.conf before running ldconfig.
Question
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 still cannot find the shared libraries. What is most likely the cause of this?
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
(36 responses)- A8% (3)
- B25% (9)
- C11% (4)
- D56% (20)
Why each option
After placing shared libraries in a custom directory, ldconfig must be told where to look by adding the path to /etc/ld.so.conf before running ldconfig.
The choice of compiler does not affect where the dynamic linker searches for shared libraries at runtime.
The PATH variable controls where the shell searches for executables, not where the dynamic linker searches for shared libraries - LD_LIBRARY_PATH would be the relevant runtime variable, but the root cause here is the missing entry in ld.so.conf.
Compiling against the wrong library would produce a compile-time or link-time error, not a runtime library-not-found failure after ldconfig has already been run.
ldconfig builds the dynamic linker cache by scanning only the directories listed in /etc/ld.so.conf. If /usr/local/applib is not listed there, ldconfig will not index those libraries regardless of how many times it is run, leaving the runtime linker unable to locate them.
Concept tested: Configuring dynamic linker cache with ldconfig and ld.so.conf
Source: https://man7.org/linux/man-pages/man8/ldconfig.8.html
Topics
Community Discussion
No community discussion yet for this question.