“lib32ncurses5 : Depends: libc6-i386 (>= 2.18) but it is not going to be installed”类似问题解决办法

本文介绍了解决在64位Linux系统中安装32位交叉编译链时遇到的兼容性问题的方法。当系统libc6版本过高导致无法安装必要的32位兼容包时,提供了一种通过直接下载并安装与当前libc6版本相匹配的deb包来解决此问题的方案。

问题背景

在64位Linux操作系统的主机上安装32位的交叉编译链时,如果64位系统与32位的工具链不兼容,在我们使用工具链对代码进行交叉编译时,往往会出现明明工具链已经安装到了指定的目录下,环境变量也都设置好了,而系统却依旧提示与arm-XXX-linux-gnueabi-g++: error while loading shared libraries:libXXXXX.so.n: cannot open shared object file: no such file or directory类似的错误。

问题描述

想要让系统32-bit的交叉编译工具链正常工作,就需要安装lib32z1、lib32ncurses5、lib32stdc++6这几个兼容包。但是如果自己的系统里的libc6的版本比较高的话,在执行安装这几个兼容包时可能会出现类似下面的问题:

lch@ThinkPad:~$ sudo apt install lib32z1 lib32ncurses5 lib32stdc++6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 lib32ncurses5 : Depends: lib32tinfo5 (= 6.0+20160213-1ubuntu1) but it is not going to be installed
                 Depends: libc6-i386 (>= 2.4) but it is not going to be installed
 lib32stdc++6 : Depends: lib32gcc1 (>= 1:4.2) but it is not going to be installed
                Depends: libc6-i386 (>= 2.18) but it is not going to be installed
 lib32z1 : Depends: libc6-i386 (>= 2.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

这里也许不太能看出这些包对libc6的版本依赖,我们再执行一下依赖包libc6-i386的安装,从提示可以明显看出libc6-i386依赖于2.23-0ubuntu11版本的libc6,而我的系统里libc6的版本为2.27-3ubuntu1。

lch@ThinkPad:~$ sudo apt-get install libc6-i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-i386 : Depends: libc6 (= 2.23-0ubuntu11) but 2.27-3ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.
系统中libc6的版本

解决办法

针对这种情况,有两种解决办法:

1. 将自己系统里的libc6版本降级为2.23,对于操作系统里的各种部件不是十分熟悉的我来说这种方法的风险略大,一个不小心系统可能会崩在我的手里,稳妥起见,不考虑这种方案。

2. 直接安装与libc6_2.27-3ubuntu1版本匹配的软件包,即直接在网上寻找版本匹配的deb包。

下载地址链接:Packages for Linux and Unix - pkgs.org

网站界面
网站界面

进入网页搜索所需的软件包,根据页面提示的软件包的版本及依赖关系下载相应的软件包并安装。要解决上述安装lib32z1、lib32ncurses5、lib32stdc++6安装过程中出现的问题,需要下载并安装下列软件包:

libc6-dev-i386_2.27-3ubuntu1_amd64.deb
libc6-i386_2.27-3ubuntu1_amd64.deb
gcc-8-base_8-20180414-1ubuntu2_amd64.deb
lib32gcc1_8-20180414-1ubuntu2_amd64.deb
lib32ncurses5_6.1-1ubuntu1_amd64.deb
lib32stdc++6_8-20180414-1ubuntu2_amd64.deb
lib32tinfo5_6.1-1ubuntu1_amd64.deb
lib32z1_1.2.11.dfsg-0ubuntu2_amd64.deb

注:网站上Ubuntu 16.04的软件包对应的libc6的版本是2.23,我需要安装的是2.27的,因而直接下载对应于2.27-3ubuntu1版本的Ubuntu 18.04的软件包,版本和依赖关系对应即可。 

安装之后查看交叉编译链版本,如打印出其详细的版本信息,说明成功解决。

32位兼容包安装成功之后的交叉编译链打印的版本信息示例
mc.lcx@raspberrypi:~ $ sudo apt install aptitude sudo aptitude install <libcamera> Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: apt : Depends: adduser but it is not going to be installed Depends: gpgv or gpgv2 but it is not going to be installed or gpgv1 Depends: libapt-pkg6.0 (>= 2.6.1) but it is not installable Depends: libc6 (>= 2.34) but it is not installable Depends: libgnutls30 (>= 3.7.5) but it is not going to be installed Depends: libseccomp2 (>= 2.4.2) but it is not going to be installed Depends: libstdc++6 (>= 11) but it is not installable Depends: libsystemd0 but it is not going to be installed Recommends: ca-certificates but it is not going to be installed base-files : PreDepends: awk base-passwd : Depends: libc6 (>= 2.34) but it is not installable Depends: libdebconfclient0 (>= 0.145) but it is not going to be installed Depends: libselinux1 (>= 3.1~) but it is not going to be installed bash : PreDepends: libc6 (>= 2.36) but it is not installable PreDepends: libtinfo6 (>= 6) but it is not installable bsdutils : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libsystemd0 but it is not going to be installed Recommends: bsdextrautils coreutils : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libattr1 (>= 1:2.4.44) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libgmp10 (>= 2:6.2.1+dfsg1) but it is not going to be installed PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed dash : PreDepends: libc6 (>= 2.34) but it is not installable debianutils : PreDepends: libc6 (>= 2.34) but it is not installable diffutils : PreDepends: libc6 (>= 2.34) but it is not installable dpkg : PreDepends: libbz2-1.0 but it is not installable PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: liblzma5 (>= 5.4.0) but it is not installable PreDepends: libmd0 (>= 0.0.0) but it is not going to be installed PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed PreDepends: libzstd1 (>= 1.5.2) but it is not installable PreDepends: zlib1g (>= 1:1.1.4) but it is not installable e2fsprogs : PreDepends: libblkid1 (>= 2.36) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libcom-err2 (>= 1.43.9) but it is not going to be installed PreDepends: libext2fs2 (= 1.47.0-2) but it is not going to be installed PreDepends: libss2 (>= 1.38) but it is not going to be installed PreDepends: libuuid1 (>= 2.16) but it is not installable Depends: logsave Recommends: e2fsprogs-l10n but it is not going to be installed findutils : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed grep : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libpcre2-8-0 (>= 10.32) but it is not going to be installed gzip : PreDepends: libc6 (>= 2.33) but it is not installable hostname : PreDepends: libc6 (>= 2.34) but it is not installable init : PreDepends: systemd-sysv or sysvinit-core but it is not installable init-system-helpers : Depends: usrmerge but it is not going to be installed or usr-is-merged but it is not going to be installed libc-bin : Depends: libc6 (> 2.36) but it is not installable Depends: libc6 (< 2.37) but it is not installable libcrypt1:armhf : Breaks: libcrypt1 (!= 1:4.4.18-4) but 1:4.4.33-2 is to be installed libcrypt1 : Depends: libc6 (>= 2.36) but it is not installable Breaks: libcrypt1:armhf (!= 1:4.4.33-2) but 1:4.4.18-4 is to be installed libgcc-s1:armhf : Breaks: libgcc-s1 (!= 10.2.1-6+rpi1) but 12.2.0-14+deb12u1 is to be installed libgcc-s1 : Depends: libc6 (>= 2.35) but it is not installable Breaks: libgcc-s1:armhf (!= 12.2.0-14+deb12u1) but 10.2.1-6+rpi1 is to be installed login : PreDepends: libaudit1 (>= 1:2.2.1) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libpam0g (>= 0.99.7.1) but it is not going to be installed PreDepends: libpam-runtime but it is not going to be installed PreDepends: libpam-modules but it is not going to be installed ncurses-bin : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libtinfo6 (>= 6.3) but it is not installable perl-base : PreDepends: libc6 (>= 2.35) but it is not installable sed : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed sysvinit-utils : Depends: libc6 (>= 2.34) but it is not installable tar : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed util-linux : PreDepends: libblkid1 (>= 2.37.2) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libcap-ng0 (>= 0.7.9) but it is not going to be installed PreDepends: libmount1 (>= 2.38) but it is not going to be installed PreDepends: libpam0g (>= 0.99.7.1) but it is not going to be installed PreDepends: libselinux1 (>= 3.1~) but it is not going to be installed PreDepends: libsmartcols1 (>= 2.38) but it is not going to be installed PreDepends: libsystemd0 but it is not going to be installed PreDepends: libtinfo6 (>= 6) but it is not installable PreDepends: libudev1 (>= 183) but it is not installable PreDepends: libuuid1 (>= 2.16) but it is not installable PreDepends: zlib1g (>= 1:1.1.4) but it is not installable Depends: util-linux-extra but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. bash: syntax error near unexpected token `newline' 根据该代码检查为什么错误
最新发布
06-25
mc.lcx@raspberrypi:/etc/apt/sources.list.d $ sudo dpkg --add-architecture armhf sudo apt update sudo apt install python3-libcamera:armhf Get:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB] Get:2 http://archive.raspberrypi.org/debian bullseye InRelease [39.0 kB] Get:3 http://archive.raspberrypi.org/debian bullseye/main Sources [81.9 kB] Get:4 http://raspbian.raspberrypi.org/raspbian bullseye/non-free Sources [141 kB] Get:5 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [330 kB] Get:6 http://raspbian.raspberrypi.org/raspbian bullseye/main Sources [12.2 MB] Get:7 http://archive.raspberrypi.org/debian bullseye/main arm64 Packages [323 kB] Get:8 http://raspbian.raspberrypi.org/raspbian bullseye/contrib Sources [82.2 kB] Get:9 http://raspbian.raspberrypi.org/raspbian bullseye/rpi Sources [1,132 B] Get:10 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB] Get:11 http://raspbian.raspberrypi.org/raspbian bullseye/contrib armhf Packages [60.2 kB] Get:12 http://raspbian.raspberrypi.org/raspbian bullseye/non-free armhf Packages [107 kB] Get:13 http://raspbian.raspberrypi.org/raspbian bullseye/rpi armhf Packages [1,360 B] Fetched 26.7 MB in 32s (830 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 5 packages can be upgraded. Run 'apt list --upgradable' to see them. W: http://raspbian.raspberrypi.org/raspbian/dists/bullseye/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'http://raspbian.raspberrypi.org/raspbian bullseye InRelease' doesn't support architecture 'arm64' N: Skipping acquire of configured file 'contrib/binary-arm64/Packages' as repository 'http://raspbian.raspberrypi.org/raspbian bullseye InRelease' doesn't support architecture 'arm64' N: Skipping acquire of configured file 'non-free/binary-arm64/Packages' as repository 'http://raspbian.raspberrypi.org/raspbian bullseye InRelease' doesn't support architecture 'arm64' N: Skipping acquire of configured file 'rpi/binary-arm64/Packages' as repository 'http://raspbian.raspberrypi.org/raspbian bullseye InRelease' doesn't support architecture 'arm64' Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: apt : Depends: adduser but it is not going to be installed Depends: gpgv or gpgv2 but it is not going to be installed or gpgv1 Depends: libapt-pkg6.0 (>= 2.6.1) but it is not going to be installed Depends: libc6 (>= 2.34) but it is not installable Depends: libgnutls30 (>= 3.7.5) but it is not installable Depends: libseccomp2 (>= 2.4.2) but it is not going to be installed Depends: libstdc++6 (>= 11) but it is not installable Depends: libsystemd0 but it is not going to be installed Recommends: ca-certificates but it is not going to be installed base-files : PreDepends: awk base-passwd : Depends: libc6 (>= 2.34) but it is not installable Depends: libdebconfclient0 (>= 0.145) but it is not going to be installed Depends: libselinux1 (>= 3.1~) but it is not installable bash : PreDepends: libc6 (>= 2.36) but it is not installable PreDepends: libtinfo6 (>= 6) but it is not installable bsdutils : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libsystemd0 but it is not going to be installed Recommends: bsdextrautils coreutils : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libattr1 (>= 1:2.4.44) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libgmp10 (>= 2:6.2.1+dfsg1) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not installable dash : PreDepends: libc6 (>= 2.34) but it is not installable debianutils : PreDepends: libc6 (>= 2.34) but it is not installable diffutils : PreDepends: libc6 (>= 2.34) but it is not installable dpkg : PreDepends: libbz2-1.0 but it is not installable PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: liblzma5 (>= 5.4.0) but it is not installable PreDepends: libmd0 (>= 0.0.0) but it is not going to be installed PreDepends: libselinux1 (>= 3.1~) but it is not installable PreDepends: libzstd1 (>= 1.5.2) but it is not going to be installed PreDepends: zlib1g (>= 1:1.1.4) but it is not installable e2fsprogs : PreDepends: libblkid1 (>= 2.36) but it is not installable PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libcom-err2 (>= 1.43.9) but it is not installable PreDepends: libext2fs2 (= 1.47.0-2) but it is not going to be installed PreDepends: libss2 (>= 1.38) but it is not going to be installed PreDepends: libuuid1 (>= 2.16) but it is not installable Depends: logsave Recommends: e2fsprogs-l10n but it is not going to be installed findutils : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not installable grep : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libpcre2-8-0 (>= 10.32) but it is not installable gzip : PreDepends: libc6 (>= 2.33) but it is not installable hostname : PreDepends: libc6 (>= 2.34) but it is not installable init : PreDepends: systemd-sysv or sysvinit-core but it is not installable init-system-helpers : Depends: usrmerge but it is not going to be installed or usr-is-merged but it is not going to be installed libc-bin : Depends: libc6 (> 2.36) but it is not installable Depends: libc6 (< 2.37) but it is not installable libcrypt1:armhf : Breaks: libcrypt1 (!= 1:4.4.18-4) but 1:4.4.33-2 is to be installed libcrypt1 : Depends: libc6 (>= 2.36) but it is not installable Breaks: libcrypt1:armhf (!= 1:4.4.33-2) but 1:4.4.18-4 is to be installed libgcc-s1:armhf : Breaks: libgcc-s1 (!= 10.2.1-6+rpi1) but 12.2.0-14+deb12u1 is to be installed libgcc-s1 : Depends: libc6 (>= 2.35) but it is not installable Breaks: libgcc-s1:armhf (!= 12.2.0-14+deb12u1) but 10.2.1-6+rpi1 is to be installed login : PreDepends: libaudit1 (>= 1:2.2.1) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libpam0g (>= 0.99.7.1) but it is not going to be installed PreDepends: libpam-runtime but it is not going to be installed PreDepends: libpam-modules but it is not going to be installed ncurses-bin : PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libtinfo6 (>= 6.3) but it is not installable perl-base : PreDepends: libc6 (>= 2.35) but it is not installable sed : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not installable sysvinit-utils : Depends: libc6 (>= 2.34) but it is not installable tar : PreDepends: libacl1 (>= 2.2.23) but it is not going to be installed PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libselinux1 (>= 3.1~) but it is not installable util-linux : PreDepends: libblkid1 (>= 2.37.2) but it is not installable PreDepends: libc6 (>= 2.34) but it is not installable PreDepends: libcap-ng0 (>= 0.7.9) but it is not going to be installed PreDepends: libmount1 (>= 2.38) but it is not installable PreDepends: libpam0g (>= 0.99.7.1) but it is not going to be installed PreDepends: libselinux1 (>= 3.1~) but it is not installable PreDepends: libsmartcols1 (>= 2.38) but it is not going to be installed PreDepends: libsystemd0 but it is not going to be installed PreDepends: libtinfo6 (>= 6) but it is not installable PreDepends: libudev1 (>= 183) but it is not installable PreDepends: libuuid1 (>= 2.16) but it is not installable PreDepends: zlib1g (>= 1:1.1.4) but it is not installable Depends: util-linux-extra but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. mc.lcx@raspberrypi:/etc/apt/sources.list.d $
06-25
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值