/usr/bin/ld: cannot find -lxxx
Depending on the code being compiled, the error message may look like:
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find -lltdl
/usr/bin/ld: cannot find -lXlst
The xxx represents the name of the library, for example, libc.so, libltdl.so, libXtst.so. The naming rule is: lib + library name (i.e. xxx) + .so.
There are 3 possible reasons for such error to occur:
1. The lib is not installed in the system;
2. Incorrect version of the installed lib;
3. Incorrect symbolic link for the lib (.so file). The link is not linked to the correct .so file.
Solutions:
1. Check whether the symbolic link is correctly linked to the .so file in /usr/lib and correct any incorrect link.
For example,
If the error message "/usr/bin/ld: cannot find -lXlst" is caused by incorrect symbolic link, issue the commands below to correct it.
cd /usr/lib
ln -s libXtst.so.6 libXtst.so
2. If the problem is not caused by incorrect symbolic link, then it's likely caused by missing lib. In this case, missing lib needs to be installed.
For example,
If the error message "/usr/bin/ld: cannot find -lXlst" is caused by missing "libXtst.so" under "/usr/lib", issue the command below to install it.
apt-get install libxtst-dev
Additional note on how to install the missing lib.
1. Identify the missing lb
Error Message Missing lib
-----------------------------------------------------------------------------
/usr/bin/ld: cannot find -lc libc
/usr/bin/ld: cannot find -lltdl libltdl
/usr/bin/ld: cannot find -lXlst libXtst
2. Search for the missing lib
apt-cache search libc-dev
apt-cache search libltdl-dev
apt-cache search libXtst-dev
3. Install the missing lib.
Reference:
No comments:
Post a Comment