error while loading shared libraries: libncurses.so.5:

LinuxUbuntuShared Libraries

Linux Problem Overview


I've installed Android Studio and tried to run my first project in it, and I've got following error:

Error Output was: /home/user/android-studio/sdk/platform-tools/adb: error while loading       shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

I've already tried to run

sudo ldconfig

but it doesnt help. I've recently installed libncurses (before using android studio).

What should I do?

Linux Solutions


Solution 1 - Linux

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

Solution 2 - Linux

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:

$ ls -1 /usr/lib/libncurses*
/usr/lib/libncurses.so
/usr/lib/libncurses++.so
/usr/lib/libncurses++w.so
/usr/lib/libncursesw.so
/usr/lib/libncurses++w.so.6
/usr/lib/libncursesw.so.6
/usr/lib/libncurses++w.so.6.0
/usr/lib/libncursesw.so.6.0

In this case, we are dealing with version 6, so we make two symlinks:

$ sudo ln -s /usr/lib/libncursesw.so.6.0 /usr/lib/libncurses.so.5
$ sudo ln -s /usr/lib/libncursesw.so.6.0 /usr/lib/libtinfo.so.5

After this, the program should run normally.

Solution 3 - Linux

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).

Solution 4 - Linux

On Arch Linux you can install ncurses5-compat-libs AUR package.

FYI it is mentioned in Arch Wiki android page, just in case if you'll need some other dependencies for Android Studio: https://wiki.archlinux.org/index.php/Android

Solution 5 - Linux

For Redhat Linux 8 try this:

sudo yum install libncurses*

Solution 6 - Linux

In Fedora 28 use:

sudo dnf install ncurses-compat-libs

Solution 7 - Linux

I solved the issue using

ln -s libncursesw.so.5  /lib/x86_64-linux-gnu/libncursesw.so.6

on ubunutu 18.10

Solution 8 - Linux

To install ncurses-compat-libs on Fedora 24 helped me on this issue (unable to start adb error while loading shared libraries: libncurses.so.5)

Solution 9 - Linux

On Arch, i fix like this:

sudo ln -s /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.6

Solution 10 - Linux

For Redhat Linux this helped,

> sudo yum install ncurses-compat-libs

Solution 11 - Linux

Your system likely does not provide the ncurses library at the version android studio uses. My arch linux install only had ncurses 6 but android studio needs version 5. You could check if your distribution has a compatability package, or use the solution that Rahmat Aligos suggested.

Solution 12 - Linux

Mixaz's above answer worked for me. However I had issues installing the package because of PGP check failures. Installing it by skipping the signature worked, you could try this :

yaourt --m-arg "--skipchecksums --skippgpcheck" -Sb <your-package>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpawelView Question on Stackoverflow
Solution 1 - LinuxHibernatedGuyView Answer on Stackoverflow
Solution 2 - LinuxRahmat AligosView Answer on Stackoverflow
Solution 3 - LinuxEdwin BuckView Answer on Stackoverflow
Solution 4 - LinuxMixazView Answer on Stackoverflow
Solution 5 - LinuxPritam BanerjeeView Answer on Stackoverflow
Solution 6 - LinuxZurab KargareteliView Answer on Stackoverflow
Solution 7 - LinuxSLuckView Answer on Stackoverflow
Solution 8 - LinuxMatthiasView Answer on Stackoverflow
Solution 9 - LinuxPrzemysław SajnógView Answer on Stackoverflow
Solution 10 - LinuxTom TaylorView Answer on Stackoverflow
Solution 11 - LinuxareiserView Answer on Stackoverflow
Solution 12 - LinuxValentin MARTINETView Answer on Stackoverflow