When compiling an application or lib source code in a Linux environment, the following error message is often displayed:
- /Usr/bin/ld: cannot find-LXXX
These messages have different results as different types of source code are compiled, for example:
- /Usr/bin/ld: cannot find-lC
- /Usr/bin/ld: cannot find-lltdl
- /Usr/bin/ld: cannot find-lxtst
Xxx indicates the name of the library file. For example, libc. So, libltdl. So, and libxtst. So.
The naming rule is: Lib + Library name (XXX) +. So.
There are three possible causes:
1. The system has not installed the corresponding lib
2. The corresponding lib version is incorrect.
3. the symbolic link of LIB (. So file) is incorrect and is not linked to the correct library file (. So)
Solution:
(1) first judge whether the symbolic link of the corresponding library file (. So) under/usr/lib is correct
If the Link Target is incorrect, the problem can be solved.
(2) If the problem is not caused by symbolic link, but the system lacks the corresponding lib to install Lib, it can be solved.
(3) how to install the missing Lib:
The preceding three error messages are used as an example:
Error 1 lib of libc missing
Error 2 lib of libltdl missing
Error 3: libxtst lib missing
Take Ubuntu as an example:
Search for the corresponding lib before installing the job, for example:
Apt-cache search libc-Dev
Apt-cache search libltdl-Dev
Apt-cache search libxtst-Dev
Instance:
When compiling the source code of the Input Method gcin, the following error message is displayed:
/Usr/bin/ld: cannot find-lxtst
After inspection, we found that:
The symbolic link of LIB (. So file) is incorrect.
The solution is as follows:
CD/usr/lib
Ln-s libxtst. so.6 libxtst. So
If the libxtst. So file cannot be found in the/usr/lib directory, it indicates that the libxtst library is not installed.
The solution is as follows:
Apt-Get install libxtst-Dev
From: http://blog.sina.com.cn/s/blog_616fb0880100xrjj.html