【linux】ubuntu20.04 运行软件 提示找不到过时的库 libQtCore.so.4、libQtGui.so.4、libpng12.so.0

先上结果

1、nxView运行起来

在这里插入图片描述

环境

硬件: Jetson Xavier NX 套件
系统:Ubuntu 20.04
软件 :nxView + libQtCore.so.4…

解决

0、现象

运行软件提示以下错误

nxView: error while loading shared libraries: libQtCore.so.4: cannot open shared object file: No such file or directory
nxView: error while loading shared libraries: libQtNetwork.so.4: cannot open shared object file: No such file or directory
nxView: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
nxView: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

最近在ubuntu20.04上安装nxView软件,安装好后在桌面打开软件时,鼠标开始转圈圈,转了几秒钟就没法应了,意识到软件应该是有什么依赖没有装好。

//这里比较关键,缺失什么依赖,全靠这一步发现
在终端上运行
sudo nxView

果然,报错!提示找不到库libQtCore.so.4。

1、分析

The Qt4 framework has been removed from Ubuntu 20.04 main repository. It is however still required for some obsolete applications.
QT4的框架在20.04及以后版本的主存储库已经删除了,也就是已经不能通过正常的apt-get安装。但是我现在又必须使用此软件,那就只能解决软件在当前系统上的依赖问题。
根结在于,老软件在新系统安装运行,缺失必要的依赖库,而依赖过时了,新系统不再支持安装,导致老软件运行不起。
在网上找了下解决方法,有使用增加apt的存储库方法的(详见参考1How to Install Qt4 Libraries in Ubuntu 20.04 [Ubuntu 22.04 Updated])。但是我尝试了下,发现并不行update后,安装时依然找不到常用qt4的库。

2、思路

根据参考2在Ubuntu20.04中继续使用linux版“网络调试助手”的方法的思路:找到硬件对应的低版本系统,在/usr/lib/aarch64-linux-gnu/里把需要的库拷出来,复制到当前系统的对应目录下即可。

但是我这里又没有第二套开发套件,又不想重装低版本系统,所以另辟蹊径地想到:
直接在网页上打开进入ubuntu的存储库,下载所需的依赖lib安装包,然后sudo dpkg -i手动进行安装。这样既可不修改系统本身安装源,又可缺什么加什么。

3、解决

0、网页上打开进入ubuntu主存储库

//最好使用自己系统sources.list里的地址
vim /etc/apt/sources.list

在这里插入图片描述

//复制网址,在网页打开,进入ubuntu 的主存储库  
 http://ports.ubuntu.com/ubuntu-ports/ 

在这里插入图片描述
进入pool目录,选择main,即可选择,根据库名字 ,导向进入对应目录进行下载 ,

1、下载所需库的安装包

qt的库在q/
在这里插入图片描述
进入
/q/qt4-x11
下 ,找到libqtcore4 ,根据自己的处理器的架构下载对应的版本,Jetson Xavier NX 需要下载arm64的 ,如果是Intel的cpu一般是amd64
在这里插入图片描述

2、安装库

在终端上手动安装

sudo dpkg -i libqtcore4_4.8.7+dfsg-5ubuntu2_arm64.deb

结果提示,当前已经有更高版本,直接安装不了

(Reading database ... 314804 files and directories currently installed.)
Preparing to unpack libqtcore4_4.8.7+dfsg-5ubuntu2_arm64.deb ...
Unpacking libqtcore4:arm64 (4:4.8.7+dfsg-5ubuntu2) over (4:4.8.7+dfsg-5ubuntu2) ...
Replaced by files in installed package qtchooser (66-2build1) ...
Replaced by files in installed package libqt5core5a:arm64 (5.12.8+dfsg-0ubuntu2.1) ...
dpkg: dependency problems prevent configuration of libqtcore4:arm64:
 qtchooser (66-2build1) breaks libqtcore4 (<< 4:4.8.7+dfsg-7~) and is installed.
  Version of libqtcore4:arm64 to be configured is 4:4.8.7+dfsg-5ubuntu2.
 libqt5core5a:arm64 (5.12.8+dfsg-0ubuntu2.1) breaks libqtcore4 (<< 4:4.8.7+dfsg-20~) and is installed.
  Version of libqtcore4:arm64 to be configured is 4:4.8.7+dfsg-5ubuntu2.

dpkg: error processing package libqtcore4:arm64 (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
/sbin/ldconfig.real: /lib/aarch64-linux-gnu/libQtGui.so.4 is not a symbolic link

/sbin/ldconfig.real: /lib/aarch64-linux-gnu/libpng12.so.0 is not a symbolic link

/sbin/ldconfig.real: /lib/aarch64-linux-gnu/libQtNetwork.so.4 is not a symbolic link

Errors were encountered while processing:
 libqtcore4:arm64

那就把deb包里的动态库拷出来,手动复制到**/usr/lib/aarch64-linux-gnu/
直接在文件浏览窗口双击打开包
进入如下目录,右键
aarch64-linux-gnu/** ,Extract(提取)到指定位置
在这里插入图片描述
在上述指定位置找到刚刚提取的库,下图三个文件都要复制哈

//给所有库都修改成全权限,然后再复制
sudo chmod 777 ./*
sudo cp ./libQtC* /usr/lib/aarch64-linux-gnu

在这里插入图片描述

3、再次在终端运行软件

sudo nxView

看是否还有缺失依赖库,若还缺失,可参照以上0-2步骤,重复解决。
我安装的nxView每次运行都只提示一个缺失库,最后解决下来发现它依赖了以下四个过时的库

libQtCore.so.4、libQtNetwork.so.4、 libQtGui.so.4、libpng12.so.0

所以,我重复了4 次才让nxView,在我的Jetson Xavier NX上运行起来。

参考

1、How to Install Qt4 Libraries in Ubuntu 20.04 [Ubuntu 22.04 Updated]
2、在Ubuntu20.04中继续使用linux版“网络调试助手”的方法
OK!
至此,问题解决。欢迎留言交流

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值