"Turn" summary on Usr/bin/ld:cannot find-lxxx problem

Source: Internet
Author: User

Original URL: http://eminzhang.blog.51cto.com/5292425/1285705

/usr/bin/ld:cannot find-lxxx Problem Summary Linux The following error is often found in compiled applications:/usr/bin/ld:cannot find-lxxx means that the compilation process cannot find the corresponding library file.        Where-lxxx represents the link library file libxxx.so.        Note: Sometimes, because the library file is generated temporarily by the compilation process, if the previous error also causes this situation, the following is due to the local system environment is missing caused by:        In general, there are several reasons for this error: 1. The system lacks the corresponding library file; 2. version does not correspond; 3. Incorrect link to the library file; 4. library file path setting issue. Corresponding to the first second case, can be resolved by downloading the installation lib, most of Ubuntu can be installed directly through Apt-get: Apt-get Install Libxxx-dev generally encountered this problem the first time I will check whether the system has installed the LIB or whether The correct version is selected (just a habit problem), if the problem is still not resolved, then the cause of the error is not a link error is the library file path problem.

Navigate to the link file via the Find or locate command to see if the link file is correctly pointing to the Lib we want, and if not, modify it with the LN-SF */libxxx.so.x */libxxx.so directive.

Compiler encountered:/USR/LIB64/GCC/X86_64-SUSE-LINUX/4.3/. /.. /.. /.. /x86_64-suse-linux/bin/ld:cannot FIND-LXML2
solve/usr/bin/ld:cannot find-lxxx problem
Questions:
Compiling the source code for the application or LIB in the Linux environment often comes with the following error message:
/usr/bin/ld:cannot find-lxxx
These messages will have different results as you compile different types of source code, such as:
/usr/bin/ld:cannot FIND-LC
/usr/bin/ld:cannot Find-lltdl
/usr/bin/ld:cannot FIND-LXTST
where xxx is the function library file name, as in the above example: libc.so, libltdl.so, libxtst.so.
Its naming rules are: lib+ library name (that is, XXX) +.so.
There are three scenarios in which this can occur:
1 system does not install the corresponding Lib
2 The corresponding Lib version is incorrect
3 lib (. so file) Symbolic link is incorrect and is not linked to the correct library file (. So)
Workaround:
(1) First determine whether the corresponding function library file (. So) under/usr/lib symbolic link is correct, if incorrectly changed to the correct link target can solve the problem.
(2) If the problem is not caused by symbolic link, but the system lacks the corresponding Lib installation lib can be solved.
(3) How to install the missing lib:
Take the above three error messages as an example:
Error 1 libc Lib is missing
Error 2 Libltdl Lib is missing
Error 3 libxtst Lib is missing
Take Ubuntu for example:
First, search for the corresponding Lib and then install the job such as:
Apt-cache Search Libc-dev
Apt-cache Search Libltdl-dev
Apt-cache Search Libxtst-dev
Example:
The following error message appears when compiling the source code for IME gcin:
/usr/bin/ld:cannot FIND-LXTST
After examination, it is found that:
Symbolic link for Lib (. so file) is incorrect
Here's how to fix it:
Cd/usr/lib
Ln-s libxtst.so.6 libxtst.so
If the libxtst.so file is not found in the/usr/lib directory, then the system does not have a library of LIBXTST installed.
The solution is as follows:
Apt-get Install Libxtst-dev

If the library file path raises a problem, you can go to the/ETC/LD.SO.CONF.D directory, modify any one of the Conf files, (you can build conf, to facilitate identification) The LIB directory is written in, and then in the terminal input ldconfig update cache.

"Turn" summary on Usr/bin/ld:cannot find-lxxx problem

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.