80

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?

15 Answers 15

146

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

4
  • 1
    I am getting this during the package install E: Package 'ia32-libs' has no installation candidate for 20.04
    – raian
    Aug 31, 2021 at 15:51
  • 1
    I met E: Unable to locate package libncurses5:i386, and solve it by dpkg --add-architecture i386 && apt update. Dec 28, 2021 at 12:05
  • 在ubuntu22上面进行aosp遇到的问题也可以通过这个解决。应该就是编译问题:prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
    – linjiejun
    May 27, 2022 at 17:02
  • I am trying to build with eas and the eas server gives this error. Can anyone please explain how to access eas server terminal or some other way to add this library there?
    – Irfan wani
    Jan 10 at 6:11
25

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.

4
  • Likewise, this does not answer the question, since it refers to software which was not available at the time the question was asked. Apr 17, 2017 at 22:49
  • 8
    Although it probably does not solve the original persons problem, it solved mine on Arch 64, that produced the exact same error message as OP. Oct 18, 2017 at 8:50
  • 4
    ls: cannot access '/usr/lib/libncurses*': No such file or directory apt says both libncurses5 and libncurses6 are installed
    – Tooniis
    Aug 16, 2019 at 16:44
  • 1
    If ls command fails, try it with the find: find /usr/lib/ -name *ncurses*
    – PolyGlot
    Apr 20, 2021 at 16:57
16

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

7
  • 2
    You can also check for the library in the LD_LIBRARY_PATH. It is possible that your path isn't set correctly so it isn't finding the library.
    – Paul
    Apr 26, 2016 at 16:53
  • In my case apt says both 32-bit and 64-bit versions of each version 5 and 6 of libncurses are installed, yet Android Studio is still complaining about the non-existence of libncurses.so.5.
    – Tooniis
    Aug 25, 2019 at 14:00
  • @Tooniis Version numbers aren't architectures, architectures roughly match the CPU in the computer, while version numbers match the "old / newer" releases. You can still be missing the correct architecture of a library, if you have the right version installed under a different architecture. This is only confusing because Intel and AMD chips support multiple architectures, i386 for backwards compatibility, and x86_64 which is the modern architecture.
    – Edwin Buck
    Aug 25, 2019 at 14:20
  • I told you I have both versions 5 and 6 for both architectures i386 and amd64 installed, so Android Studio should be able to find whatever it needs.
    – Tooniis
    Aug 25, 2019 at 14:23
  • @Tooniis Sorry, didn't see that part about "both architectures". In this case, it is typically because you have a missing / misconfigured LD_LIBRARY_PATH in the shell before you launch Android Studio, or your Android Studio maintains its own configuration for this functionality. I'd check in the compiler options (Sorry Android Studio has changed a lot from when I used it heavily, so I can't just point you to the option). In any case, once you get the /usr/lib/ (32bit) or /usr/lib64 (64 bit) configured you should see success.
    – Edwin Buck
    Aug 25, 2019 at 14:26
15

For Redhat Linux 8 try this:

sudo yum install libncurses*
2
  • This is the solution for Oracle Linux
    – Zucca
    Jul 12 at 13:33
  • 1
    This also worked for CentOS/AlmaLinux. It was required by the LSI MegaCli RAID controller command line tool.
    – humbads
    Jul 27 at 18:23
10

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

7

In Fedora 28 use:

sudo dnf install ncurses-compat-libs
2
  • This also did the trick on Fedora 30. Texas Instruments Code Composer Studio 9 (in 2019) based on eclipse also needs ncurses5 while 6 is the default on Fedora. Oct 4, 2019 at 11:10
  • Works on centos 9 as well.
    – akhan
    Jun 14 at 6:42
5

For Redhat Linux this helped,

sudo yum install ncurses-compat-libs

4

I solved the issue using

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

on ubunutu 18.10

1
  • 1
    Because I had libncursesw6 already installed in my ubuntu 20.04, I did sudo apt install libncursesw6 and it solved it. So I additively installed version 5 not adding symbolic link. I think your method does no harm too.
    – Chan Kim
    May 14, 2021 at 4:47
2

On Arch, i fix like this:

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

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)

1

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.

2
  • 1
    The question was asked two years before release of ncurses 6. Apr 17, 2017 at 22:49
  • A bit late again (seems to be my thing) but I encountered this specific issue at the time of writing my answer.
    – areiser
    Feb 7, 2018 at 17:49
0

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>
0

Oracle Linux 8 / Red Hat 8 (EL8): These platforms by default do not install the file /lib64/libtinfo.so.5.To work around this issue, install the ncurses-compat-libs package: yum install ncurses-compat-libs

https://dev.mysql.com/doc/mysql-solaris-excerpt/8.0/en/binary-installation.html

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 25 at 8:10
0

I faced this issue on the last 3 Fedora (38,37,36) releases. If you would like to use an older x86_64 package, a simple symlink creation can solve the problem.

cd /usr/lib64/
ln -s libncurses.so.6 libncurses.so.5

Before the link

[root@terminus ~]# MegaCli64 -AdpAllInfo -aALL
MegaCli64: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

After the symlink.

[root@terminus lib64]# MegaCli64 -AdpAllInfo -aALL

Adapter #0
...
New contributor
dacccs is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

For Rocky Linux 9. need to enable devel with config-manager before installing it :

dnf config-manager --set-enabled devel
dnf install ncurses-compat-libs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.