Have you seen this?

error while loading shared libraries: can't open shared object file: No such file or directory

This error stops your app. Your box can’t find a file. These files end in .so. They help apps work. This guide will fix it fast.

Find the File That Is Gone

Read your error. It tells you which file is gone. Look at this:

error while loading shared libraries: libssl.so.1.1: can't open shared object file...

The file is libssl.so.1.1. Write it down. You need this name.

Check If the File Is on Your Box

Run this:

$ sudo find / -name "libssl.so*" 2>/dev/null

Did it find the file? Write down where it is. No file? Go to the next step.

Get the File You Need

You must add the file. Use your package tool.

On Ubuntu or Debian:

$ sudo apt install libssl-dev

Search for items:

$ apt search libssl

On CentOS or Red Hat:

$ sudo dnf install libssl

Search with:

$ dnf search libssl
Note: Names are not the same on all boxes. The file libssl.so.1.1 might be in libssl-dev. Or it might be in openssl-libs.

Tell Your Box Where to Look

The file might be in a strange place. Your app can’t see it. Tell your box where it is.

Quick Fix

This works now:

$ export LD_LIBRARY_PATH=/your/library/folder:$LD_LIBRARY_PATH

It stops when you close the shell.

Long-term Fix

Add the path for good:

$ sudo sh -c 'echo "/your/library/folder" >> /etc/ld.so.conf.d/custom.conf'
$ sudo ldconfig

Change /your/library/folder to the real path.

Warning: Wrong paths can break apps. Check the path first.

Update the File List

Run this when you make changes:

$ sudo ldconfig

This fixes most error while loading shared libraries bugs. It updates the file list.

Check 32-bit vs 64-bit

32-bit files don’t work with 64-bit apps. Check your box:

$ uname -m

On 64-bit Ubuntu, get 32-bit files. Do it like this:

$ sudo apt install libxyz:i386

Put your file name where libxyz is.

Tip: Run file /path/to/library.so to check a file. Look for “ELF 64-bit” or “ELF 32-bit” in the text.

See All Files That Are Gone

Use ldd to check what your app needs:

$ ldd /path/to/your/application

Files that are gone show as “not found”.

Sample

$ ldd /usr/bin/myprogram
    linux-vdso.so.1 (0x00007ffd8b3fe000)
    libssl.so.1.1 => not found
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8e4c000000)

The “not found” line shows what is wrong.

Build Your App Again

If none of this works, build it once more:

$ ./configure --prefix=/usr/local --libdir=/usr/local/lib
$ make
$ sudo make install

This helps when paths are wrong.

Quick Guide

Problem Fix
File is gone Use apt or dnf
File in wrong spot Set LD_LIBRARY_PATH
32-bit vs 64-bit Get the right type
Links are dead Install it once more

Sum Up

Most error while loading shared libraries bugs are not hard to fix. Get the file. Set the paths. Run ldconfig. Done.

Still stuck? Share your error. Share your Linux type.

FAQs

This error occurs when a program can’t find its required .so files. The lib might be gone, put in a strange spot, or not match your box type.

Check the error message for the library filename. Use ldd /path/to/program to see all dependencies and identify which ones show “not found” in the output.

Yes, running sudo ldconfig rebuilds the linker cache. After adding libraries or updating paths in /etc/ld.so.conf, ldconfig makes these changes permanent across reboots.

Yes, but LD_LIBRARY_PATH only works for the current terminal session. For permanent fixes, add your library path to /etc/ld.so.conf.d/ instead.

The lib might be 32-bit when you need 64-bit. Check with uname -m and add the right type with your package tool.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.