Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the ldd under Linux?

Shulou Source: shulou.com Published: 2022-06-01 13:05:58 10月04日 Update

This article mainly explains "what is ldd under Linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is ldd under Linux"?

1. First of all, ldd is not an executable program, but just a shell script

2. Ldd can display the dependency of the executable module, the principle is by setting a series of environment variables, as follows: LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, LD_VERBOSE and so on. When the LD_TRACE_LOADED_OBJECTS environment variable is not empty, any executable program will only display the dependency of the module when it is running, and the program will not actually execute. Or you can test it at the shell terminal, as follows:

(1) export LD_TRACE_LOADED_OBJECTS=1

(2) execute any program, such as ls, to see the running result of the program.

3. Ldd shows the working principle of dependency of executable module, which is realized by ld-linux.so (loader of elf dynamic library). We know that the ld-linux.so module will work before the executable module program and gain control, so when the above environment variables are set, ld-linux.so chooses to display the dependency of the executable module.

4. You can actually execute the ld-linux.so module directly, such as / lib/ld-linux.so.2-- list program (which is equivalent to ldd program)

Onebyte:

The role of ldd: recently, the program has been unable to run, and I would like to use ldd to see which runtime it loads, but because it has been cross-compiled on HOST, it is useless to use ldd on HOST. Since then, there has been no good way. After reading this article today, I suddenly realized that ldd is just a script file, so why don't you just copy it to TARGET? Do it at once, and it really works! It's great to find that the program is missing the library of libqte.so.3. Just copy one from the HOST.

At this point, I believe you have a deeper understanding of "what is ldd under Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Program module run variable environment content principle just actual script study work practical deeper suddenly realize function interest method dynamic easy to use Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS vpn MySQL Shulou Information Shulou Tech Info