error while loading shared libraries 🐧 Linux

error while loading shared libraries: libX.so.N: cannot open shared object file: No such file or directory

The program needs a shared library (.so) that isn’t installed or isn’t on the loader’s search path.

Seen on: Linux

Meaning

Binaries are linked against specific library versions (libssl.so.1.1, libffi.so.7). After an OS upgrade or on a minimal image, the version may be missing. Libraries installed to /usr/local/lib may need ldconfig or LD_LIBRARY_PATH.

Common causes

  • Library package not installed (minimal image/container)
  • Program built for an older/newer distro version
  • Library in a non-standard path without ldconfig
  • 32-bit program missing 32-bit libraries

⚡ Quick fix

  1. Find which package provides it (apt-file search / dnf provides)
  2. Install the matching version or rebuild the program
  3. Run sudo ldconfig after installing into /usr/local/lib

Detailed fix by platform

Linux

  1. bash
    ldd ./myprogram | grep 'not found'
    sudo apt install apt-file && sudo apt-file update && apt-file search libssl.so.1.1
    sudo ldconfig

How to diagnose

  1. Missing — ldd output
  2. Version — Which version exists (ls /usr/lib/x86_64-linux-gnu | grep ssl)
  3. Path — ldconfig -p | grep name

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.