riscv-mcu/riscv-gnu-toolchain

riscv gdb or clang execute with error: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

Closed this issue · 1 comments

Take ubuntu 20.04 and Nuclei RISC-V Toolchain 2023.10 for example:

root@f00b5c5f4751:/work/2023.10/gcc/bin# ./riscv64-unknown-elf-gdb -v
./riscv64-unknown-elf-gdb: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
root@f00b5c5f4751:/work/2023.10/gcc/bin# ./riscv64-unknown-elf-clang -v
./riscv64-unknown-elf-clang: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

Here is sample log to install dependencies for Ubuntu 20.04 when using Nuclei RISC-V Toolchain 2023.10.

root@e8b72f6bc450:/work/2023.10# cd gcc/bin/
root@e8b72f6bc450:/work/2023.10/gcc/bin# ldd riscv64-unknown-elf-gdb
        linux-vdso.so.1 (0x00007fff25bdb000)
        libtinfo.so.5 => not found
        libncursesw.so.5 => not found
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f243ba47000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f243b8f8000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f243b8d5000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f243b6e1000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f243ba51000)
root@e8b72f6bc450:/work/2023.10/gcc/bin# ldd riscv64-unknown-elf-clang
        linux-vdso.so.1 (0x00007ffe231c8000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5fdd145000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f5fdd13b000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5fdd135000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5fdd119000)
        libtinfo.so.5 => not found
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5fdcf35000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5fdcde6000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5fdcdcb000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5fdcbd9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5fdd16c000)
root@e8b72f6bc450:/work/2023.10/gcc/bin# ldd riscv64-unknown-elf-gcc
        linux-vdso.so.1 (0x00007ffd40d65000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007feee2785000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feee2593000)
        /lib64/ld-linux-x86-64.so.2 (0x00007feee28d8000)
root@e8b72f6bc450:/work/2023.10/gcc/bin# apt install libtinfo libncursesw
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libtinfo
E: Unable to locate package libncursesw
root@e8b72f6bc450:/work/2023.10/gcc/bin# apt update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [1183 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [3318 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [29.7 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [3415 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3891 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [32.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [3468 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1477 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]
Fetched 30.3 MB in 6s (5034 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
47 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@e8b72f6bc450:/work/2023.10/gcc/bin# apt install libtinfo libncursesw
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libtinfo
E: Unable to locate package libncursesw
root@e8b72f6bc450:/work/2023.10/gcc/bin# apt install libncursesw5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libgpm2 libtinfo5
Suggested packages:
  gpm
The following NEW packages will be installed:
  libgpm2 libncursesw5 libtinfo5
0 upgraded, 3 newly installed, 0 to remove and 47 not upgraded.
Need to get 217 kB of archives.
After this operation, 982 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libgpm2 amd64 1.20.7-5 [15.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libtinfo5 amd64 6.2-0ubuntu2.1 [83.4 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libncursesw5 amd64 6.2-0ubuntu2.1 [119 kB]
Fetched 217 kB in 2s (134 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libgpm2:amd64.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../libgpm2_1.20.7-5_amd64.deb ...
Unpacking libgpm2:amd64 (1.20.7-5) ...
Selecting previously unselected package libtinfo5:amd64.
Preparing to unpack .../libtinfo5_6.2-0ubuntu2.1_amd64.deb ...
Unpacking libtinfo5:amd64 (6.2-0ubuntu2.1) ...
Selecting previously unselected package libncursesw5:amd64.
Preparing to unpack .../libncursesw5_6.2-0ubuntu2.1_amd64.deb ...
Unpacking libncursesw5:amd64 (6.2-0ubuntu2.1) ...
Setting up libgpm2:amd64 (1.20.7-5) ...
Setting up libtinfo5:amd64 (6.2-0ubuntu2.1) ...
Setting up libncursesw5:amd64 (6.2-0ubuntu2.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
root@e8b72f6bc450:/work/2023.10/gcc/bin# ldd riscv64-unknown-elf-clang
        linux-vdso.so.1 (0x00007fff7e59a000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe0d04a000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efe0d040000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe0d03a000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efe0d01e000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007efe0cff0000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efe0ce0c000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe0ccbd000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efe0cca2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe0cab0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efe0d071000)
root@e8b72f6bc450:/work/2023.10/gcc/bin# ldd riscv64-unknown-elf-gdb
        linux-vdso.so.1 (0x00007ffe2a7f3000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f20a287c000)
        libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f20a284a000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f20a2844000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f20a26f5000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f20a26d2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f20a24de000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f20a28ae000)
root@e8b72f6bc450:/work/2023.10/gcc/bin# ./riscv64-unknown-elf-gdb --version
GNU gdb (GDB) 13.2.90.20230712-git
Copyright (C) 2023 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.
root@e8b72f6bc450:/work/2023.10/gcc/bin# ./riscv64-unknown-elf-clang --version
clang version 17.0.2 (git@gito.corp.nucleisys.com:software/devtools/llvm-project 657e6b77fd825e79481f53aaf012b542c2baf1fd)
Target: riscv64-unknown-unknown-elf
Thread model: posix
InstalledDir: /work/2023.10/gcc/bin/.
root@e8b72f6bc450:/work/2023.10/gcc/bin# ./riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=./riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/work/2023.10/gcc/bin/../libexec/gcc/riscv64-unknown-elf/13.1.1/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /builds/software/devtools/riscv-gnu-toolchain/gcc/configure --target=riscv64-unknown-elf --prefix=/work/toolchain/install/linux64/newlibc/2023.10/gcc --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion=gf9cd87fed --with-system-zlib --enable-tls --with-newlib --with-sysroot=/work/toolchain/install/linux64/newlibc/2023.10/gcc/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=/builds/software/devtools/riscv-gnu-toolchain/gcc --enable-multilib --with-multilib-generator='rv32ec-ilp32e--;rv32eac-ilp32e--;rv32emc-ilp32e--;rv32emac-ilp32e--;rv32ic-ilp32--;rv32iac-ilp32--;rv32imc-ilp32--;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv32imac_zba_zbb_zbc_zbs-ilp32--;rv32imafc_zba_zbb_zbc_zbs-ilp32f--;rv32imafdc_zba_zbb_zbc_zbs-ilp32d--;rv32ima_zca_zcb_zcmp_zcmt-ilp32--;rv32imaf_zca_zcb_zcf_zcmp_zcmt-ilp32f--;rv32imafd_zca_zcb_zcf_zcmp_zcmt-ilp32d--;rv32imafd_zca_zcb_zcf_zcd-ilp32d--;rv32ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs-ilp32--;rv32imaf_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs-ilp32f--;rv32imafd_zca_zcb_zcf_zcd_zba_zbb_zbc_zbs-ilp32d--;rv32imafd_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs-ilp32d--;rv32imac_xxldsp-ilp32--;rv32imafc_xxldsp-ilp32f--;rv32imafdc_xxldsp-ilp32d--;rv32imac_zba_zbb_zbc_zbs_xxldsp-ilp32--;rv32imafc_zba_zbb_zbc_zbs_xxldsp-ilp32f--;rv32imafdc_zba_zbb_zbc_zbs_xxldsp-ilp32d--;rv32ima_zca_zcb_zcmp_zcmt_xxldsp-ilp32--;rv32imaf_zca_zcb_zcf_zcmp_zcmt_xxldsp-ilp32f--;rv32imafd_zca_zcb_zcf_zcd_xxldsp-ilp32d--;rv32imafd_zca_zcb_zcf_zcmp_zcmt_xxldsp-ilp32d--;rv32ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs_xxldsp-ilp32--;rv32imaf_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs_xxldsp-ilp32f--;rv32imafd_zca_zcb_zcf_zcd_zba_zbb_zbc_zbs_xxldsp-ilp32d--;rv32imafd_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs_xxldsp-ilp32d--;rv64imac-lp64--;rv64imafc-lp64f--;rv64imafdc-lp64d--;rv64imac_zba_zbb_zbc_zbs-lp64--;rv64imafc_zba_zbb_zbc_zbs-lp64f--;rv64imafdc_zba_zbb_zbc_zbs-lp64d--;rv64ima_zca_zcb_zcmp_zcmt-lp64--;rv64imaf_zca_zcb_zcmp_zcmt-lp64f--;rv64imafd_zca_zcb_zcd-lp64d--;rv64ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs-lp64--;rv64imaf_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs-lp64f--;rv64imafd_zca_zcb_zcd_zba_zbb_zbc_zbs-lp64d--;' --with-abi=lp64 --with-arch=rv64ima --with-tune=rocket --with-isa-spec=2.2 'CFLAGS_FOR_TARGET=-Os    -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-Os    -mcmodel=medany'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 13.1.1 20230713 (gf9cd87fed)

You can always use ldd command to check missing libraries, and use apt search or yum search to search missing libraries and try to install and fix it.

Thanks

For missing libgmp.so.3, check Nuclei-Software/nuclei-linux-sdk#5