Search code examples
ubuntuarmgnu

Message "Unable to run arm-none-eabi-gdb: cannot find libncurses.so.5"


I recently installed the ARM GCC toolchain on Ubuntu 18.10 (Cosmic Cuttlefish) using sudo apt-get install gcc-arm-none-eabi and am trying to run arm-none-eabi-gdb.

Whenever I try to run it I get the following error:

arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

I have tried to install libncurses using sudo apt-get install libncurses5-dev libncursesw5-dev- the libraries installed successfully, but I still have the same issue.

I also checked to make sure the file was 64 bit: arm-none-eabi-gdb: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=340c78388950836989ecda5c89474e1bf7b03820, stripped

What can I try from here?


Solution

  • I installed Ubuntu 18.10 desktop (Cosmic Cuttlefish) from here, but I was unable to install gcc-arm-none-eabi:

    ubuntu@ubuntu:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.10
    Release:        18.10
    Codename:       cosmic
    
    ubuntu@ubuntu:~$ sudo apt-get install gcc-arm-none-eabi
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package gcc-arm-none-eabi
    

    I then installed libncurses5-dev and gcc-linaro-7.3.1-2018.05-x86_64_arm and got the same .so-related error you got.

    Since I don't have this issue with 16.04 nor with 18.04, I would suggest you compile the latest GDB from source in order to avoid what may be a package/dynamic link library mismatch issue in Ubuntu 18.10:

    sudo apt-get install build-essential libncurses5-dev libexpat1-dev texinfo-doc-nonfree
    pushd /tmp
    wget -qO- ftp://ftp.gnu.org/gnu/gdb/gdb-8.2.tar.xz | tar Jxv
    mkdir gdb
    cd gdb
    ../gdb-8.2/configure  --enable-tui --with-expat --prefix=/usr/local  --target=arm-eabi --program-prefix=arm-eabi-
    make all
    sudo make  install
    popd
    

    Install will fail because makeinfo is missing, even though I installed texinfo-doc-nonfree, but binaries will be installed:

    ls /usr/local/bin
    arm-eabi-gdb  arm-eabi-gdb-add-index  arm-eabi-run
    

    And arm-eabi-gdb will launch properly this time:

    arm-eabi-gdb --version
    GNU gdb (GDB) 8.2
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    

    arm-eabi-gdb -tui will work as well - I encourage you to use the TUI mode. You should like it as much as I do - I guess.