Error whilel oading shared libraries: libluajit-5.1.so.2: cannot open shared solution

Source: Internet
Author: User

Error whilel oading shared libraries: libluajit-5.1.so.2: cannot open shared solution

Generally, when executing some external programs in Linux, we may prompt that the shared library cannot be found, for example:

 

Tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory


There are two common causes. One is that the operating system does not contain the Shared Library (lib *. so. * file) or the version of the shared library is incorrect. In this case, download and install it online.

Another reason is that the shared library has been installed, but when you execute the program that needs to call the shared library, the program cannot find the shared library file according to the default shared library path.

After installing the shared library, pay attention to the following issues:

1) if the shared library file is installed in the/lib or/usr/lib directory, run the ldconfig command.

The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and dynamic library configuration file/etc/ld. so. search for the shared dynamic link library (Format: lib *. so *) to create a dynamic loader (ld. so) the required connection and cache file. the default cached file is/etc/ld. so. cache. This file stores the list of Dynamic Linked Library names in the sorted order.

2) If the shared library file is installed in/usr/local/lib (many open-source shared libraries are installed in this directory) or other "non-/lib or/usr/lib" directories, add the new Shared Library directory to the shared library configuration file/etc/ld before executing the ldconfig command. so. conf, as follows:

# Cat/etc/ld. so. conf
Include ld. so. conf. d/*. conf
# Echo "/usr/local/lib">/etc/ld. so. conf
# Ldconfig

3) if the shared library file is installed in another "non-/lib or/usr/lib" directory, but does not want to be in/etc/ld. so. add path in conf (or do not have permission to add path ). you can export a global variable LD_LIBRARY_PATH, and then find the shared library in the directory when running the program.

LD_LIBRARY_PATH indicates the directories in which the loader can find the shared library. you can set multiple search directories separated by colons. for example, if you have installed a mysql file to the/usr/local/mysql directory, a large number of library files are under/usr/local/mysql/lib. bashrc or. add the following statement to bash_profile or shell:

Export LD_LIBRARY_PATH =/usr/local/mysql/lib: $ LD_LIBRARY_PATH

Generally, this is only a temporary solution, which is used when you do not have the permission or need it temporarily.

4) if the library file required by the program is lower than the existing village file version in the system, you can make a link
For example:
Error while loading shared libraries: libncurses. so.4: cannot open shared
Object file: No such file or directory

Ls/usr/lib/libncu *
/Usr/lib/libncurses. a/usr/lib/libncurses. so.5
/Usr/lib/libncurses. so/usr/lib/libncurses. so.5.3

Although libncurses. so.4 is not available, libncurses. so.5 is backward compatible.
Just create a link.
Ln-s/usr/lib/libncurses. so.5.3/usr/lib/libncurses. so.4


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.