brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ldd lists the shared libraries a Linux program needs and which ones are missing

Linux
~/tips/tip-linux-ldd-missing-libraries

ldd /usr/local/bin/tool

Find out why a program will not start with 'error while loading shared libraries'.

A program you copied or built yourself refuses to start with error while loading shared libraries. ldd shows which library it is looking for and where the system finds each one.

ldd /usr/local/bin/tool

Every line is one library: its name, an arrow, and the path where the dynamic loader finds it. A line that says not found is your problem. Filter for those directly:

ldd /usr/local/bin/tool | grep 'not found'

With the missing name in hand, you can search which package provides it, for example with apt-file search libssl.so.1.1 on Debian. Often the answer is that the program was built for a different release, which ships a newer version of the library under another name.

It also helps when a program picks up the wrong copy of a library. If the path behind the arrow points to /opt or /usr/local instead of the system folder, something on the library path takes precedence.

The ldd man page has a clear warning that I take seriously: some versions of ldd may run the program itself to find out what it needs. Never use it on a program you do not trust. For an unknown binary, objdump -p program | grep NEEDED lists the needed library names without running anything. Statically linked programs, such as many Go tools, have nothing to list, and ldd says not a dynamic executable.

Further reading: ldd(1) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link