Error-Resolve/usr/bin/ld:cannot find-lxxx problem

Source: Internet
Author: User

This article is from: http://blog.chinaunix.net/uid-354915-id-3573647.html


Today compiled program encountered:/USR/LIB64/GCC/X86_64-SUSE-LINUX/4.3/. /.. /.. /.. /x86_64-suse-linux/bin/ld:cannot find-lxml2 Online Inquiry, recorded as follows:
Solve the problem of/usr/bin/ld:cannot find-lxxx
Problem:
The source code that compiles the application or LIB in the Linux environment often appears with the following error message:
/usr/bin/ld:cannot find-lxxx
These messages have different results as they compile different types of source code:
/usr/bin/ld:cannot FIND-LC
/usr/bin/ld:cannot Find-lltdl
/usr/bin/ld:cannot FIND-LXTST
where xxx represents the function library file name, as in the example above: libc.so, libltdl.so, libxtst.so.
Its naming convention is: lib+ Library name (that is, XXX) +.so.
There are three scenarios that can occur for this reason:
1 system does not install the corresponding Lib
2 The corresponding Lib version is not correct
The symbolic link for 3 lib (. so file) is incorrect and is not linked to the correct function library file (. So)
Workaround:
(1) First of all, the/usr/lib of the corresponding function library file (. So) symbolic link is correct, if not correctly changed to the correct link target can solve the problem.
(2) If not symbolic link problem caused, but the system is missing the corresponding Lib installation lib can be resolved.
(3) How to install the missing lib:
Take the above three error messages as an example:
Error 1 missing libc Lib
Error 2 missing Libltdl Lib
Error 3 missing libxtst Lib
Take Ubuntu for example:
Search for the corresponding Lib to install the job such as:
Apt-cache Search Libc-dev
Apt-cache Search Libltdl-dev
Apt-cache Search Libxtst-dev
Instance:
The following error message occurs when the source code for input method Gcin is compiled:
/usr/bin/ld:cannot FIND-LXTST
After inspection, it is found that:
Symbolic link for Lib (. so file) is incorrect
The workaround is as follows:
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 the LIBXTST function library installed.
The solution is as follows:

Apt-get Install Libxtst-dev


Note: If it is/usr/bin/ld:cannot Find-liconv, it is because the Iconv library is not installed (if it is not found in the library directory), you need to go to the http://ftp.gnu.org/gnu/libiconv/download installation

Decompression: TAR-ZXVF libiconv-1.14.tar.gz

CD./libiconv-1,14

Install (default installation to/usr/local)

./configure

Make

Make install


Summary:

      first check to see if the library file is in the/usr/lib directory, and if the link is correct. If it is not installed, it can be installed. If the link is wrong, re-establish the link.

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.