error while loading shared libraries: libncurses.so解决过程 原创

zhushangyuan_
发布于 2021-6-24 09:33
浏览
2收藏

@toc

记录如何解决error while loading shared libraries: libncurses.so

简单记录下在执行 make menuconfig过程中的下述报错:

zhushy@ubuntu:~/openharmony/kernel/liteos_a$ make menuconfig
/home/zhushy/openharmony/kernel/liteos_a/tools/menuconfig/mconf /home/zhushy/openharmony/kernel/liteos_a/Kconfig
/home/zhushy/openharmony/kernel/liteos_a/tools/menuconfig/mconf: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
make: *** [Makefile:140: menuconfig] Error 127

......

root@ubuntu:/home/zhushy/openharmony/kernel/liteos_a# make menuconfig
/home/zhushy/openharmony/kernel/liteos_a/tools/menuconfig/mconf /home/zhushy/openharmony/kernel/liteos_a/Kconfig
/home/zhushy/openharmony/kernel/liteos_a/tools/menuconfig/mconf: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
make: *** [Makefile:140: menuconfig] Error 127

1、出现问题的环境

使用vmware worstation安装的Ubuntu 21.04:

root@ubuntu:/home/zhushy/openharmony/kernel/liteos_a# cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.04
DISTRIB_CODENAME=hirsute
DISTRIB_DESCRIPTION="Ubuntu 21.04"
NAME="Ubuntu"
VERSION="21.04 (Hirsute Hippo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 21.04"
VERSION_ID="21.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=hirsute
UBUNTU_CODENAME=hirsute

2、解决步骤

2.1 搜索找不到库文件的位置

  • 执行如下命令find / -name *ncurse*查找libncurses.so.5的位置:
root@ubuntu:/home/zhushy/openharmony/kernel/liteos_a# find / -name *ncurse*
...
/snap/core18/1997/lib/x86_64-linux-gnu/libncurses.so.5
/snap/core18/1997/lib/x86_64-linux-gnu/libncurses.so.5.9
/snap/core18/1997/lib/x86_64-linux-gnu/libncursesw.so.5
/snap/core18/1997/lib/x86_64-linux-gnu/libncursesw.so.5.9
/snap/core18/1997/usr/share/doc/libncurses5
/snap/core18/1997/usr/share/doc/libncursesw5
/snap/core18/1997/usr/share/doc/ncurses-base
/snap/core18/1997/usr/share/doc/ncurses-bin
/snap/core18/1997/usr/share/lintian/overrides/ncurses-base
/snap/core18/2074/lib/x86_64-linux-gnu/libncurses.so.5
/snap/core18/2074/lib/x86_64-linux-gnu/libncurses.so.5.9
/snap/core18/2074/lib/x86_64-linux-gnu/libncursesw.so.5
/snap/core18/2074/lib/x86_64-linux-gnu/libncursesw.so.5.9
/snap/core18/2074/usr/share/doc/libncurses5
/snap/core18/2074/usr/share/doc/libncursesw5
/snap/core18/2074/usr/share/doc/ncurses-base
/snap/core18/2074/usr/share/doc/ncurses-bin
/snap/core18/2074/usr/share/lintian/overrides/ncurses-base
find: ‘/run/user/1000/gvfs’: Permission denied
  • 执行如下命令find / -name *libtinfo*查找libtinfo.so.5的位置:
root@ubuntu:/home/zhushy/openharmony/kernel/liteos_a# find / -name *libtinfo*                                                                                 
/snap/core18/1997/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core18/1997/lib/x86_64-linux-gnu/libtinfo.so.5.9
/snap/core18/1997/usr/share/doc/libtinfo5
/snap/core18/2074/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core18/2074/lib/x86_64-linux-gnu/libtinfo.so.5.9
/snap/core18/2074/usr/share/doc/libtinfo5
find: ‘/run/user/1000/gvfs’: Permission denied

通过检索,可以尝试使用下如下的文件:

  • /snap/core18/1997/lib/x86_64-linux-gnu/libncurses.so.5.9
  • /snap/core18/1997/lib/x86_64-linux-gnu/libncursesw.so.5.9
  • /snap/core18/1997/lib/x86_64-linux-gnu/libtinfo.so.5.9

2.2 为找到的库文件创建软链接

执行如下命令创建软链接:

 ln -s /snap/core18/1997/lib/x86_64-linux-gnu/libncurses.so.5.9 /usr/lib/x86_64-linux-gnu/libncurses.so.5
ln -s /snap/core18/1997/lib/x86_64-linux-gnu/libncursesw.so.5.9 /usr/lib/x86_64-linux-gnu/libncursesw.so.5.9
ln -s /snap/core18/1997/lib/x86_64-linux-gnu/libtinfo.so.5.9 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

重新执行make menunconfig,即可正常工作:
error while loading shared libraries: libncurses.so解决过程-鸿蒙开发者社区

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
libncurses.so.md 7.16K 16次下载
4
收藏 2
回复
举报
1条回复
按时间正序
/
按时间倒序
zhushangyuan_
zhushangyuan_

https://askubuntu.com/questions/1252062/how-to-install-libncurses-so-5-in-ubuntu-20-04

 

```

sudo add-apt-repository universe
sudo apt-get install libncurses5 libncurses5:i386

```

回复
2021-8-6 02:06:57
回复
    相关推荐