Error : loading shared libraries: cannot open shared object file: No such file or directory
1. Problem Description:
The program s
needs the support of Library L1
and Library L2
to run Library L1/L2
after installation, when executing software s, Library L2 shared object
cannot be loaded, prompting that the file or path does not exist
**2. Solution:**
When the library is dynamic library
, you need to indicate the path of the dynamic library for the operating system when running the program s
.
2.1 determine the path of Library
:
$ sudo find/-name library_name.so
2.2 determine whether the dynamic library path exists in the environment variable (ld_library_path)
$ echo $LD_LIBRARY_PATH
2.3 assign the dynamic library path to the environment variable (ld_library_path)
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/the/lib
$ export LD_LIBRARY_PATH
You can run the program.
expand:
**1. Library files in linux
System: * *
library is a collection of precompiled code segments called functions. Libraries contain common functions that together form a package called a library. Functions are blocks of code that are reused throughout the program. Calling these code fragments repeatedly in the program can save time. You can avoid rewriting code multiple times. For programmers, libraries provide reusable functions, data structures, classes, and so on.
Libraries are not executable, which is the key difference between processes and applications. Libraries work at run time or compile time. In C programming language, there are two types of Libraries: dynamic library and static library.
**Dynamic and static libraries: * *
dynamic or shared libraries
appear as independent files other than executable program files. Therefore, the program only needs one copy of the dynamic/shared library file at run time. The static libraries are locked in the program.
**2. linux
system environment variables: * *
environment variables and shell
variables:
Environment variables are managed by the shell
. The difference between environment variables and regular shell
variables is that shell
variables are local variables of specific instances of shell
, such as shell scripts, while environment variables are “inherited” by any program you start, including another shell
. In other words, the new process obtains copies of its own variables. It can read and modify these variables and pass them to its child processes in turn. In fact, every UNIX
process (not just shell
) passes its environment variables to its child processes.
Environment variables are globally available in programs and their subroutines. Shell variables are only available in the current shell. Environment variables like $shell
are valid system wide. In the current bash shell
, $bash
points to the execution path of bash
, while $shell
points to the shell
(its value may be the same) defined as Default
.
#Define the shell variable VAR and its value
[biocodee@localhost ~]$ VAR="This is a variable"
[biocodee@localhost ~]$ echo $VAR
This is a variable
# See if the shell variable exists in the environment variable env
[biocodee@localhost ~]$ env | grep VAR
# Convert a shell variable to an environment variable
[biocodee@localhost ~]$ export VAR
[biocodee@localhost ~]$ env | grep VAR
VAR=This is a variable
Read More:
- [Solved] ××: error while loading shared libraries: ××.so.19: cannot open shared object file: No such file or directory
- [Solved] Ubuntu Compile AOSP Error: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
- [Solved] /usr/local/libexec/mecab/mecab-dict-index: error while loading shared libraries: libmecab.so.2: cannot open shared object file: No such file or directory
- [Solved] error while loading shared libraries: libjson.so.0: cannot open shared object file: No such file or
- [Solved] mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No s
- [Solved] error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such…
- [Solved] error while loading shared libraries: libmpc.so.3: cannot open shared object file
- [Solved] Python Import mmcv Warning: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Linux Ubuntu ImportError: Libtk8.5.so: cannot open shared object file:No such file Install tkinter Library
- [Solved] ImportError:lib***.so–cannot open shared object file: No such…(pycharm/clion Error but shell No Error)
- Centos7.2 Install vscode Error: error while loading shared libraries: libxkbcommon.so.0: cannot open shared pro
- Petalinux Failed to open PetaLinux lib: librdi_commonxillic.so: cannot open shared object file:
- error while loading shared libraries [How to Solve]
- Error while loading shared libraries [How to Solve]
- [Solved] openssl error: libcrypto.so.1.0.0: cannot open shared object file: Error 40
- [Solved] gawk: error while loading shared libraries: libreadline.so.4
- [Solved] error while loading shared libraries: libmysql.so.16
- error while loading shared libraries: libz.so.1 [How to Solve]
- error while loading shared libraries: libmetis.so [How to Solve]
- [Solved] Centos8 openssh Compile Error: error while loading shared libraries