Error in loading shared libraries: lib xxx..so. x: cannot open shared object file: No such file or directory
-
Resolve by update PATH variable
-
Resolve by setting SHELLPATH variable
-
Resolve by updating LD_LIBRARY_PATH
-
Resolve by setting LIBRARY_PATH variable
The error indicates the dynamic linker cannot find a required shared library at runtime. The LD_LIBRARY_PATH environment variable tells the dynamic linker where to search for shared libraries beyond the default paths. Options A, B, and D are incorrect: PATH is for executables, SHELLPATH doesn't exist for this purpose, and LIBRARY_PATH is used at compile time, not runtime.
This is a classic Linux dynamic linker error. The runtime linker (ld.so) searches the directories listed in LD_LIBRARY_PATH (plus ldconfig's cache and default paths) when resolving shared object (.so) dependencies at program startup. If the library lives in a non-standard directory, adding that directory to LD_LIBRARY_PATH lets the loader find it. PATH only affects lookup of executables, not shared libraries. SHELLPATH and LIBRARY_PATH are not the relevant runtime environment variables recognized by the dynamic linker (LIBRARY_PATH affects the linker/gcc at compile time, not runtime loading).