Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux system prompt / usr/bin/ld: cannot find-lxxx error what to do

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to do the hint / usr/bin/ld: cannot find-lxxx error in the Linux system. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The following error message often appears when compiling the source code of an application or lib in a linux environment:

/ 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 represents the name of the library file, as in the example above: libc.so, libltdl.so, libXtst.so.

Its naming convention is: lib+ library name (i.e. xxx) + .so.

There are three reasons why this happens:

1 the corresponding lib is not installed on the system

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 determine whether the symbolic link of the corresponding function library file (.so) under / usr/lib is correct

If it is not changed correctly to the correct link target, the problem can be solved.

(2) if the problem is not caused by symbolic link, but the system lacks the corresponding lib installation lib, it can be solved.

(3) how to install missing lib:

Take the above three error messages as an example:

The code is as follows:

Error 1 missing LIB for libc

Error 2 missing LIB for libltdl

Error 3 missing LIB for libXtst

Take Ubuntu as an example:

Search for the corresponding LIB before installing, such as:

The code is as follows:

Apt-cache search libc-dev

Apt-cache search libltdl-dev

Apt-cache search libXtst-dev

Example:

The following error message occurs when compiling the Source Code of the input method gcin:

The code is as follows:

/ usr/bin/ld: cannot find-lXtst

After examination, it was found that:

The symbolic link of lib (.so file) is incorrect

The solution is as follows:

The code 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, the system does not have a library installed for libXtst.

The solution is as follows:

Apt-get install libxtst-dev

This is the end of the article on "hints in the Linux system / usr/bin/ld: what to do with cannot find-lxxx errors". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report