Cannot Open Shared Object no Such File or Directory [Fix]
To fix this manually install the missing packages
3 min. read
Published on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
The Cannot open shared object no such file or directory usually affects developers that are using Linux or WSL on Windows. This error will prevent you from adding libraries to your project, so it’s important to fix it.
How do I fix Cannot open shared object no such file or directory error?
1. Install the missing library
- Look at the error message. You should see the name of the library that is missing.
- Install it by running the following command:
sudo apt-get install your_library_name
- Wait for the process to finish.
A few users reported using sudo apt install –reinstall for libraries that are already installed, so try that as well.
If you’re getting this error while installing Qt, run the following command to install its dependencies:
sudo apt-get -y install build-essential openssl libssl-dev libssl1.0 libgl1-mesa-dev libqt5x11extras5 '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
2. Run the ldconfig command
This command will update the shared library cache and hopefully fix the problem.
3. Check for missing dependencies using the ldd
- In the command line enter
ldd ./name_of_the_package
- You’ll see a list of modules that it uses.
- Look for the ones saying not found.
- Install the missing modules with the terminal.
Pay close attention as some applications might be using a 32-bit architecture, so you’ll need to install modules that match that architecture.
4. Use the strip command
- In the command line run the following:
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
- Wait for the process to finish.
- Check if the problem is gone.
Keep in mind that this solution works only for libQt5Core.so.5, so be sure to change the library name in Step 1 name according to your error.
5. Manually add the library to the library path
- Run the following command to find the path of your library:
sudo find / -name the_name_of_the_file.so
- Next, run the following to display the value of
LD_LIBRARY PATH: echo $LD_LIBRARY_PATH
- If LD_LIBRARY_PATH is empty, run
LD_LIBRARY_PATH=/usr/local/lib
- Next, add the library path from Step 1, like this: export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/
The Cannot open shared object no such file or directory error will give you problems while developing, but luckily, you can fix this by installing the missing packages by following these steps.
This isn’t the only coding error you can encounter, and many reported PermissionError Errno 13 as well as OSError Errno 48.
If you’re a Python user, don’t miss our guide on the Python Runtime error for more information.
User forum
0 messages