The “error while loading shared libraries: cannot open shared object file” message appears in Linux when a program cannot locate a required shared library (.so file). When this happens, the application stops immediately and refuses to start.

This error commonly appears on Ubuntu, Debian, Arch Linux, Fedora, and other Linux distributions after installing software manually, compiling programs from source, running Python or Conda environments, or launching developer tools and game servers.
In this guide, you will learn how to identify the missing library, install the correct dependency, refresh the system library cache, and restore program functionality quickly.
Quick Fix for the Error
If you want to try the fastest solution first, run these commands:
sudo ldconfigThen check the program dependencies:
ldd program_nameExample:
ldd ./applicationIf a library is missing, Linux will show:
libssl.so.3 => not foundInstall the missing package and run the program again.
Why This Error Happens
Linux programs rely on shared libraries to perform many functions. Instead of embedding all code inside the application, Linux loads external libraries when the program starts.
The error appears when Linux cannot find the required library. Common causes include:
- Required library not installed
- Library installed but not in system path
- Incorrect library version
- Broken package installation
- Library cache not updated
- Incorrect environment variables
- 32-bit / 64-bit library mismatch
Once you identify the missing dependency, the fix usually takes only a few minutes.
Step 1 — Check Which Library Is Missing
The error message usually tells you exactly which library is missing.
Example:
error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directoryIn this example, the missing library is:
libssl.so.3Write down the library name before continuing.
Step 2 — Check Dependencies Using ldd
The ldd command shows which libraries a program requires.
Run:
ldd program_nameExample:
ldd ./myappIf Linux cannot locate a dependency, the output shows:
libssl.so.3 => not foundThis confirms which library you need to install.
Step 3 — Install the Missing Library
Install the required package using your Linux distribution’s package manager.
Ubuntu / Debian
sudo apt update
sudo apt install libssl3If another library is missing:
sudo apt install libstdc++6You can also install development libraries:
sudo apt install build-essentialArch Linux
sudo pacman -S opensslFedora / RHEL / CentOS
sudo dnf install opensslor
sudo yum install opensslAfter installing the package, launch the program again.
Step 4 — Find Which Package Contains the Library
If you do not know which package provides the library, search your package database.
On Debian or Ubuntu systems:
Install the search tool:
sudo apt install apt-fileUpdate the database:
sudo apt-file updateSearch the library:
apt-file search libssl.so.3The command will show the package that contains the file.
Install the suggested package.
Step 5 — Check if the Library Exists but Is Not in the Path
Sometimes the library already exists, but Linux cannot find it.
Search for the file:
find /usr -name "libssl.so*"If the library exists in another directory, add that directory to the library path.
Example:
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATHTo make the change permanent:
echo 'export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrcStep 6 — Refresh the Library Cache
Linux maintains a cache of shared libraries. If the cache is outdated, programs may fail to detect installed libraries.
Refresh the cache using:
sudo ldconfigThen launch the program again.
Step 7 — Reinstall the Broken Package
If the library exists but the error continues, reinstall the package.
Ubuntu / Debian:
sudo apt reinstall opensslor
sudo apt reinstall libstdc++6Arch Linux:
sudo pacman -S opensslFedora:
sudo dnf reinstall opensslReinstalling restores missing library files.
Step 8 — Fix Python or Anaconda Shared Library Errors
This error frequently appears inside Python or Conda environments.
Update packages:
conda update --allInstall missing dependencies:
conda install opensslIf the environment is broken, recreate it:
conda create -n newenv python=3.11
conda activate newenvStep 9 — Fix 32-Bit / 64-Bit Library Mismatch
Some programs require 32-bit libraries on a 64-bit system.
Check the program type:
file programnameIf the program is 32-bit, install compatibility libraries:
sudo apt install libc6:i386Step 10 — Fix Errors After Compiling Software From Source
If you built the application manually, install it properly and update the system library links.
Run:
sudo make install
sudo ldconfigThis ensures Linux registers the newly installed libraries.
Common Shared Library Errors and Fixes
| Error | Fix |
|---|---|
| libssl.so.3 not found | Install libssl3 |
| libstdc++.so.6 missing | Install libstdc++6 |
| libcrypto.so missing | Install openssl |
| libGL.so.1 missing | Install libgl1 |
These are among the most common Linux shared library issues.
FAQs
What does “error while loading shared libraries cannot open shared object file” mean?
This error means Linux cannot find a required shared library (.so file) that a program needs to run.
How do I fix “cannot open shared object file” in Linux?
Identify the missing dependency using ldd program_name, install the required package with your package manager, and refresh the library cache using sudo ldconfig.
How can I find which shared library is missing?
Run ldd program_name in the terminal to list dependencies and check which library shows “not found.”
What is a shared object file (.so) in Linux?
A shared object (.so) file is a dynamic library that Linux programs load at runtime to access reusable code and system functions.
Why does the libssl.so or libstdc++.so error appear?
These errors appear when the required library package is not installed or when the program expects a different library version than the one available on the system.
Can running ldconfig fix shared library errors?
Yes, running sudo ldconfig refreshes the system library cache and helps Linux detect newly installed shared libraries.
Can reinstalling a package fix the shared library error?
Yes, reinstalling the package that provides the missing library can restore broken or missing dependency files.
Do Python or Conda environments cause shared library errors?
Yes, Python tools such as Conda environments may require specific libraries, and missing dependencies inside the environment can trigger this error.
Can 32-bit programs cause shared library errors on a 64-bit system?
Yes, a 32-bit program may fail if the required 32-bit libraries are not installed on a 64-bit Linux system.
Which Linux distributions commonly show this error?
This error frequently appears on Ubuntu, Debian, Arch Linux, Fedora, and CentOS when dependencies are missing or libraries are not detected in the system path.