- Ошибка error while loading shared libraries
- Что означает error while loading shared libraries?
- Как исправить ошибку?
- 1. Библиотека не установлена
- 2. Библиотека находится не в том каталоге
- 3. Неверная версия библиотеки
- Выводы
- error while loading shared libraries: libncurses.so.5:
- 12 Answers 12
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- 19 Answers 19
- ldconfig
- Dev package or wrong version
- Library location
- sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
- 14 Answers 14
- error while loading shared libraries: libnsl.so.1 #13
- Comments
- twhiston commented Jun 5, 2018 •
- probonopd commented Jun 5, 2018
- knapsu commented Jun 5, 2018
- probonopd commented Jun 5, 2018
- twhiston commented Jun 5, 2018
- probonopd commented Jun 6, 2018
- Conan-Kudo commented Jun 6, 2018
- probonopd commented Jun 6, 2018 •
- Conan-Kudo commented Jun 6, 2018
- probonopd commented Jun 6, 2018 •
- knapsu commented Jul 8, 2018
- probonopd commented Jul 8, 2018 •
- knapsu commented Jul 8, 2018
- probonopd commented Jul 8, 2018
- pnaraya4 commented Jan 31, 2019
- probonopd commented Jan 31, 2019 •
- msashish commented Oct 27, 2020
- husamazma commented Nov 10, 2020
Ошибка error while loading shared libraries
Новые и опытные пользователи Linux могут сталкиваться с ошибкой error loading shared libraries во время запуска программ, также с ней могут сталкиваться программисты и все желающие компилировать программное обеспечение в своей системе. Эта ошибка в дословном переводе означает что возникла проблема во время загрузки общей библиотеки. О том что такое библиотеки и зачем они нужны вы можете узнать из статьи библиотеки Linux.
В этой же статье мы рассмотрим что значит ошибка error while loading shared libraries более подробно, а главное, как ее решить.
Что означает error while loading shared libraries?
Даже если вы не компилируете свои программы, то вы можете увидеть ошибку error while loading shared libraries: имя_библиотеки: cannot open shared object file: No such file or directory достаточно часто во время установки новых программ не через пакетный менеджер или программ, предназначенных для другого дистрибутива. Как я уже говорил, она возникает потому, что система не может найти библиотеку.
А вот почему ее нельзя найти и загрузить, это уже интересно. Этому может быть несколько причин:
- Библиотека не установлена в системе;
- Библиотека установлена, но неизвестно куда;
- Библиотека установлена правильно, но имеет не ту версию.
При решении проблемы мы будем руководствоваться именно этими причинами и пытаться их решить.
Как исправить ошибку?
1. Библиотека не установлена
Первый вариант, тут все понятно, библиотеки просто нет в системе, поэтому мы и получаем такую ошибку. Верный способ ее решения — просто найти пакет библиотеки с помощью пакетного менеджера и установить ее. Обычно, пакеты с библиотеками называются так же, как и сами библиотеки с префиксом lib.
Например, если нам не хватает библиотеки libfuse2.so, то мы можем найти ее в Ubuntu такой командой:
sudo apt search libfuse2
Затем осталось только установить ее:
sudo apt install libfuse2
Если перед вами стоит задача собрать программу из исходников, то вам понадобится не только установить саму библиотеку, но и заголовочные файлы для нее:
sudo apt install libfuse-dev
И так для любой библиотеки. Но это не всегда помогает.
2. Библиотека находится не в том каталоге
Бывает что библиотека установлена, мы установили ее или она поставлялась вместе с программой, но ошибка как была, так и есть. Причиной этому может быть то, что загрузчик Linux не может найти библиотеку.
Поиск библиотек выполняется по всех папках, которые указаны в конфигурационных файлах /etc/ld.conf.d/. По умолчанию, это такие каталоги, как /usr/lib, /lib, /usr/lib64, /lib64. Если библиотека установлена в другой каталог, то, возможно, это и есть причина проблемы.
Вы можете посмотреть какие библиотеки сейчас доступны загрузчику с помощью команды:
Найти, где находится ваша библиотека можно с помощью команды locate. Например, нас интересует библиотека librtfreader.so:
Теперь мы знаем, что она находится по адресу /opt/kingsoft/wps-office/office6/. А значит, для работы программы необходимо сделать чтобы загрузчик библиотек ее видел. Для этого можно добавить путь в один из файлов /etc/ld.so.conf.d/ или же в переменную LD_LIBRARY_PATH:
Опять же, так вы можете поставить с любой библиотекой, которая взывает ошибку. Еще один более простой метод — это просто создать символическую ссылку на нужную библиотеку в правильной папке:
ln -s /opt/kingsoft/wps-office/office6/librtfreader.so /usr/lib/librtfreader.so
3. Неверная версия библиотеки
Эта причина ошибки довольно часто встречается при использовании программ не для вашего дистрибутива. Каждая библиотека имеет дополнительную версию, так называемую ревизию, которая записывается после расширения .so. Например, libav.so.1. Так вот, номер версии меняется всякий раз, когда в библиотеку вносятся какие-либо исправления.
Часто возникает ситуация, когда в одном дистрибутиве программа собирается с зависимостью от библиотеки, например, libc.so.1, а в другом есть только libc.so.2. Отличия в большинстве случаев здесь небольшие и программа могла бы работать на второй версии библиотеки. Поэтому мы можем просто создать символическую ссылку на нее.
Например, библиотеки libusb-1.0.so.1 нет. Но зато есть libusb-1.0.so.0.1, и мы можем ее использовать:
Для этого просто создаем символическую ссылку на библиотеку:
sudo ln -s /usr/lib/libusb-1.0.so.0.1 /usr/lib/libusb-1.0.so.1
В большинстве случаев программа не заметит подмены и будет работать, как и ожидалось. Также для решения этой проблемы можно попытаться найти нужную версию библиотеки в интернете для своей архитектуры и поместить ее в папку /usr/lib/ или /usr/lib64/. Но после этого желательно обновить кэш:
Выводы
В этой статье мы рассмотрели почему возникает ошибка Error while loading shared libraries, а также как ее решить. В большинстве случаев проблема решается довольно просто и вы получите работоспособную программу. Надеюсь, эта информация была полезной для вас.
Источник
error while loading shared libraries: libncurses.so.5:
I’ve installed Android Studio and tried to run my first project in it, and I’ve got following error:
I’ve already tried to run
but it doesnt help. I’ve recently installed libncurses (before using android studio).
What should I do?
12 Answers 12
If libncurses is not installed then install it and try again.
for 32-bit binaries : sudo apt-get install libncurses5:i386
for 64-bit binaries : sudo apt-get install libncurses5
Also install the collection of libraries by using this command,
sudo apt-get install ia32-libs
error while loading shared libraries: libncurses.so.5
If you see this, your distro probably has a newer version of libncurse installed. First find out what version of libncurses your distro has:
In this case, we are dealing with version 6, so we make two symlinks:
After this, the program should run normally.
If you are absolutely sure that libncurses, aka ncurses, is installed, as in you’ve done a successful ‘ls’ of the library, then perhaps you are running a 64 bit Linux operating system and only have the 64 bit libncurses installed, when the program that is running (adb) is 32 bit.
If so, a 32 bit program can’t link to a 64 bit library (and won’t located it anyway), so you might have to install libcurses, or ncurses (32 bit version). Likewise, if you are running a 64 bit adb, perhaps your ncurses is 32 bit (a possible but less likely scenario).
Источник
Linux error while loading shared libraries: cannot open shared object file: No such file or directory
Program is part of the Xenomai test suite, cross-compiled from Linux PC into Linux+Xenomai ARM toolchain.
Edit: OK I didn’t notice the .1 at the end was part of the filename. What does that mean anyway?
19 Answers 19
Your library is a dynamic library. You need to tell the operating system where it can locate it at runtime.
To do so, we will need to do those easy steps:
(1 ) Find where the library is placed if you don’t know it.
(2) Check for the existence of the dynamic library path environment variable( LD_LIBRARY_PATH )
if there is nothing to be displayed, add a default path value (or not if you wish to)
(3) We add the desire path, export it and try the application.
Note that the path should be the directory where the path.so.something is. So if path.so.something is in /my_library/path.so.something it should be :
Here are a few solutions you can try:
ldconfig
As AbiusX pointed out: If you have just now installed the library, you may simply need to run ldconfig.
ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib).
Usually your package manager will take care of this when you install a new library, but not always, and it won’t hurt to run ldconfig even if that is not your issue.
Dev package or wrong version
If that doesn’t work, I would also check out Paul’s suggestion and look for a «-dev» version of the library. Many libraries are split into dev and non-dev packages. You can use this command to look for it:
This can also help if you simply have the wrong version of the library installed. Some libraries are published in different versions simultaneously, for example, Python.
Library location
If you are sure that the right package is installed, and ldconfig didn’t find it, it may just be in a nonstandard directory. By default, ldconfig looks in /lib , /usr/lib , and directories listed in /etc/ld.so.conf and $LD_LIBRARY_PATH . If your library is somewhere else, you can either add the directory on its own line in /etc/ld.so.conf , append the library’s path to $LD_LIBRARY_PATH , or move the library into /usr/lib . Then run ldconfig .
To find out where the library is, try this:
(Replace libraryname with the name of your library)
If you go the $LD_LIBRARY_PATH route, you’ll want to put that into your
/.bashrc file so it will run every time you log in:
Update
While what I write below is true as a general answer about shared libraries, I think the most frequent cause of these sorts of message is because you’ve installed a package, but not installed the «-dev» version of that package.
Источник
sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
Please suggest a solution for solving this issue?? While giving the command:
the error that occurred:
14 Answers 14
The minimum configuration to properly run sqlplus from the shell is to set ORACLE_HOME and LD_LIBRARY_PATH . For ease of use, you might want to set the PATH accordingly too.
Assuming you have unzipped the required archives in /opt/oracle/instantclient_11_1 :
I did solve this error by setting
yes, not only $ORACLE_HOME/lib but $ORACLE_HOME too.
You should already have all needed variables in /etc/profile.d/oracle.sh . Make sure you source it:
The file’s content looks like:
If you don’t have it, create it and source it.
PERMISSIONS: I want to stress the importance of permissions for «sqlplus».
For any «Other» UNIX user other than the Owner/Group to be able to run sqlplus and access an ORACLE database , read/execute permissions are required (rx) for these 4 directories :
$ORACLE_HOME/bin , $ORACLE_HOME/lib, $ORACLE_HOME/oracore, $ORACLE_HOME/sqlplus
Environment. Set those properly:
A. ORACLE_HOME (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/ )
B. LD_LIBRARY_PATH (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib )
I know it’s an old thread, but I got into this once again with Oracle 12c and LD_LIBRARY_PATH has been set correctly. I have used strace to see what exactly it was looking for and why it failed:
sqlplus tries to load this lib from different dirs, some didn’t exist in my install. Then it tried the one I already had on my LD_LIBRARY_PATH:
open(«/oracle/product/12.1.0/db_1/lib/libsqlplus.so», O_RDONLY) = -1 EACCES (Permission denied)
So in my case the lib had 740 permissions, and since my user wasn’t an owner or didn’t have oracle group assigned I couldn’t read it. So simple chmod +r helped.
You can try usage:
This problem are because oracleinstant client not configure shared library.
Could you please check if LD_LIBRARY_PATH points to the oracle libs
On Ubuntu Server 20.04 and using instant client version 19.10.0.0, I used alien to install the rpm package. I got this error when I just used the -i option. However when, I added -c I did not have this issue. from the man page for alien:
-c, —scripts
Try to convert the scripts that are meant to be run when the package is installed and removed. Use this with caution, because these scripts might be designed to work on a system unlike your own, and could cause problems. It is recommended that you examine the scripts by hand and check to see what they do before using this option.
So it seems the correct configuration (in 19c) or the environment variables (in earlier versions) are set in these scripts which are not generated unless you run alien like this. (Thanks @Christopher Jones for correcting me on this)
Источник
error while loading shared libraries: libnsl.so.1 #13
Comments
twhiston commented Jun 5, 2018 •
With Fedora 28 (atomic workstation) I see the following error:
However I have glibc installed
The text was updated successfully, but these errors were encountered:
probonopd commented Jun 5, 2018
libnsl is not glibc. Do you have libnsl installed?
knapsu commented Jun 5, 2018
@twhiston as a workaround run the following in a terminal:
sudo dnf install libnsl
This should install the library that is missing from AppImage bundle. Don’t know why it’s not included in the package.
probonopd commented Jun 5, 2018
Indeed it is on https://github.com/AppImage/AppImages/blob/master/excludelist, seemingly because it was assumed to be part of glibc. Looks like this assumption was wrong or only correct for some distributions?
twhiston commented Jun 5, 2018
@probonopd It’s in glibc in fedora 27 but not fedora 28
probonopd commented Jun 6, 2018
Uh oh. UH OH! This is screaming Desktop Linux Platform Issues. distros can’t even seem to agree what is part of glibc and what is not?!
Conan-Kudo commented Jun 6, 2018
@probonopd It’s built from the glibc source package, it’s just subpackaged out because it’s a deprecated library.
probonopd commented Jun 6, 2018 •
Applications still might use it, so the Fedora/glibc team should not deprecate it. «Deprecate» in my opinion should be announced well ahead of time (a couple of years!) and only be executed once virtually all consumers have stopped consuming it.
Randomly «deprecating» stuff while consumers are still using it is just breaking it for users.
Conan-Kudo commented Jun 6, 2018
That makes no sense. People won’t stop using it unless people know to stop using it. Deprecation notices are quite literally the only way to make that work.
probonopd commented Jun 6, 2018 •
Notices yes. But not just doing it without notice well ahead of time.
knapsu commented Jul 8, 2018
probonopd commented Jul 8, 2018 •
So you are saying the only thing that pulls in NSL is the bundled libnss*? I’m interested to see whether deleting libnss* from the AppImage will have any ill consequences.
knapsu commented Jul 8, 2018
It was committed on 8-th May (2 months ago). No one complained about it so far.
probonopd commented Jul 8, 2018
So far I had assumed that libnss3.so should not be removed from the bundles, as this causes other issues, e.g., probonopd/linuxdeployqt#35 (comment).
pnaraya4 commented Jan 31, 2019
installing packages libX11.i686 and libnsl.i686 resolved my issue
probonopd commented Jan 31, 2019 •
libnsl should be bundled with the application. Would this resolve the issue?
msashish commented Oct 27, 2020
If it helps: I was using RHEL8 base image with python 3.8 and Oracle instant client which gave me the same error when I attempted to access using cx_Oracle. I read that libnsl.so.1 is removed from glibc package and there is a libnsl.so.2 that comes with RHEL8 base image.
Symlink-ing libnsl.so.1 worked for me:
ln -s /usr/lib64/libnsl.so.2 /usr/lib64/libnsl.so.1
husamazma commented Nov 10, 2020
please try: sudo yum install libnsl
it automatically created a ln : /usr/lib64/libnsl.so.1 -> libnsl-2.28.so
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник