Compiling the source code for the application or LIB in the Linux environment often comes with the following error message:
The code is as follows:/usr/bin/ld:cannot find-lxxx
These messages will have different results as you compile different types of source code, such as:
The code is as follows:/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) Determine if the symbolic link of the corresponding function library file (. So) under/usr/lib is correct
The problem can be solved by incorrectly changing the correct link target.
(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:
The code is as follows:
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:
The code is as follows: Apt-cache search Libc-dev
Apt-cache Search Libltdl-dev
Apt-cache Search Libxtst-dev
Instance:
The following error message appears when compiling the source code for IME gcin:
The code is as follows:/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:
The code 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 a library of LIBXTST installed.
The solution is as follows:
The code is as follows:
Apt-get Install Libxtst-dev
Common solution to/usr/bin/ld:cannot find-lxxx errors in Linux systems