Error while loading shared Libraries:libluajit-5.1.so.2:cannot open shared solution

Source: Internet
Author: User

In general, when we execute some external programs under Linux, we may be prompted to find errors in the shared library, such as:


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


There are generally two reasons, one is that the operating system does not contain the shared library (lib*.so.* file) or the shared library version is not correct, in this case, go to the Internet download and install it.

Another reason is that you have installed the shared library, but when you execute a program that calls the shared library, the program cannot find the shared library file by default shared library path.

Therefore, after installing the shared library, you should pay attention to the shared library path setting problem as follows:

1) If the shared library file is installed in the/lib or/usr/lib directory, then you need to execute the ldconfig command

The purpose of the Ldconfig command is to search for a shareable dynamic-link library (in the form of lib*.so*) in the default search directory (/lib and/usr/lib) and the directory listed in the dynamic library configuration file/etc/ld.so.conf, creating a dynamic Loader program ( ld.so) The required connection and cache files. The cache file defaults to/etc/ld.so.cache, which holds a list of queued dynamic-link library names.

2) If the shared library file is installed in/usr/local/lib (many open source shared libraries will be installed in this directory) or in other "non-/lib or/usr/lib" directories, then the new Shared library directory will be added to the shared library profile before the Ldconfig command is executed. Etc/ld.so.conf, the following:

#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 a different "non-/lib or/usr/lib" directory, but does not want to add the path in the/etc/ld.so.conf (or there is no permission to add the path). That can export a global variable ld_library_path, and then run the program will go to this directory to find the shared library.

Ld_library_path means to tell loader which directories can be found in the shared library. You can set up multiple search directories separated by colons. For example, install a MySQL into the/usr/local/mysql directory, where there are a lot of library files under/usr/local/mysql/lib, you can add the following statements in the. BASHRC or. Bash_profile or shell:

Export ld_library_path=/usr/local/mysql/lib: $LD _library_path

In general, this is a temporary solution that is used when there is no authority or temporary need.

4) If the program requires a library file that is lower than the existing village file version, you can do a link
Like what:
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

Visible Although there is no libncurses.so.4, but there are libncurses.so.5, can be backwards compatible
Just build a link.
Ln-s/usr/lib/libncurses.so.5.3/usr/lib/libncurses.so.4


Error while loading shared Libraries:libluajit-5.1.so.2:cannot open shared solution

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.