Cannot Open Shared Object no Such File or Directory [Fix]

To fix this manually install the missing packages

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

cannot open shared object no such file or directory
XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

For fixing DLL errors, we recommend Fortect:

Fortect will search for an intitial version of your missing, corrupted or damaged DLL files that cause problems to your Windows OS and will replace it. Here is how to find them in 3 easy steps:

  • Download Fortect and install it on your PC
  • Launch the tool and Start scanning to find DLL files that could be causing PC problems
  • Right-click on Start Repair to replace all broken DLLs or fix them one by one from the console
Download Now Fortect has been downloaded by 0 readers this month, rated 4.6 on TrustPilot

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

  1. Look at the error message. You should see the name of the library that is missing.
  2. Install it by running the following command: sudo apt-get install your_library_name
    sudo apt install
  3. 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

  1. In your Terminal, run sudo ldconfig -v
  2. Wait for the process to finish.
    sudo ldconfig -v
  3. Check if the error is gone.

This command will update the shared library cache and hopefully fix the problem.

3. Check for missing dependencies using the ldd

  1. In the command line enter ldd ./name_of_the_package
    ldd command
  2. You’ll see a list of modules that it uses.
  3. Look for the ones saying not found.
  4. 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

  1. In the command line run the following: sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    sudo strip
  2. Wait for the process to finish.
  3. 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

  1. Run the following command to find the path of your library: sudo find / -name the_name_of_the_file.so
    sudo find
  2. Next, run the following to display the value of LD_LIBRARY PATH: echo $LD_LIBRARY_PATH
    echo library
  3. If LD_LIBRARY_PATH is empty, run LD_LIBRARY_PATH=/usr/local/lib
    ld library path
  4. Next, add the library path from Step 1, like this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/
    export ld 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.

More about the topics: files, Linux, WSL

User forum

0 messages