Use the ldd Command

Configurare noua (How To)

Situatie

Solutie

Pasi de urmat

Execute the following command to get more information about a program:

ldd -v /path/to/program/executable

The output shows version information as well as the paths and addresses to the shared libraries, like this:

libshared.so
linux-vdso.so.1 => (0x00007fff26ac8000)
libc.so.6 => /lib/libc.so.6 0x00007ff1df55a000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff1dfafe000)
Linux ldd command

If the SO file doesn’t exist at all, you can find the missing libraries using the following command:

ldd -d path/to/program

The output is similar to the following:

linux-vdso.so.1 (0x00007ffc2936b000)
/home/gary/demo/garylib.so => not foundlibc.so.6 => usr/lib/libc.so.6 (0x00007fd0c6259000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd0c65fd000)
Linux ldd command missing

Never run the ldd command against an untrusted program because the ldd command might execute it. Instead, use a safer alternative that shows the direct dependencies only and not the whole dependency tree:

objdump -p /path/to/program | grep NEEDED
Linux objdump ldd alternative

Tip solutie

Permanent

Voteaza

(4 din 12 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?