我想交叉编译一个程序,该程序与 SAM_A5d27 板上的设备“/dev/i2c-0”进行通信。为此,我需要 Ubuntu-18.04 桌面中的 libi2c-dev 包。由于 SAM_A5d27 具有 arm 架构,因此我将 armhf 架构添加到“dpkg”,并尝试在 armhf 中安装 libi2c-dev,但出现错误“E:无法找到包 libi2c-dev:armhf”。我遵循了以下步骤。请看一下并帮助我解决这个问题。
gp@guru-hp:~$ sudo dpkg --add-architecture armhf
gp@guru-hp:~$ sudo apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://dl.google.com/linux/chrome/deb stable Release
Get:5 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:6 http://ppa.launchpad.net/js-reynaud/kicad-5.1/ubuntu bionic InRelease
Get:7 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages [968 kB]
Ign:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages
Get:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages [8,360 B]
Get:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages [8,360 B]
Get:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages [8,360 B]
Ign:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages
Ign:32 http://in.archive.ubuntu.com/ubuntu bionic/universe armhf Packages
Ign:33 http://in.archive.ubuntu.com/ubuntu bionic/multiverse armhf Packages
Ign:34 http://in.archive.ubuntu.com/ubuntu bionic-updates/main armhf Packages
Ign:35 http://in.archive.ubuntu.com/ubuntu bionic-updates/restricted armhf Packages
Ign:36 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe armhf Packages
Ign:37 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse armhf Packages
Ign:38 http://in.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
Ign:39 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Ign:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages
Ign:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages
Ign:32 http://in.archive.ubuntu.com/ubuntu bionic/universe armhf Packages
Ign:33 http://in.archive.ubuntu.com/ubuntu bionic/multiverse armhf Packages
Ign:34 http://in.archive.ubuntu.com/ubuntu bionic-updates/main armhf Packages
Ign:35 http://in.archive.ubuntu.com/ubuntu bionic-updates/restricted armhf Packages
Ign:36 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe armhf Packages
Ign:37 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse armhf Packages
Ign:38 http://in.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
Ign:39 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Ign:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages
Ign:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages
Ign:32 http://in.archive.ubuntu.com/ubuntu bionic/universe armhf Packages
Ign:33 http://in.archive.ubuntu.com/ubuntu bionic/multiverse armhf Packages
Ign:34 http://in.archive.ubuntu.com/ubuntu bionic-updates/main armhf Packages
Ign:35 http://in.archive.ubuntu.com/ubuntu bionic-updates/restricted armhf Packages
Ign:36 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe armhf Packages
Ign:37 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse armhf Packages
Ign:38 http://in.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
Ign:39 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Ign:40 http://security.ubuntu.com/ubuntu bionic-security/main armhf Packages
Get:41 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [651 kB]
Err:9 http://in.archive.ubuntu.com/ubuntu bionic/main armhf Packages
404 Not Found [IP: 2403:8940:ffff::f 80]
Get:42 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages [442 kB]
Get:43 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [211 kB]
Get:44 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Get:45 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Get:46 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Get:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages [3,968 B]
Ign:28 http://in.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages
Ign:32 http://in.archive.ubuntu.com/ubuntu bionic/universe armhf Packages
Ign:33 http://in.archive.ubuntu.com/ubuntu bionic/multiverse armhf Packages
Err:34 http://in.archive.ubuntu.com/ubuntu bionic-updates/main armhf Packages
404 Not Found [IP: 2403:8940:ffff::f 80]
Ign:35 http://in.archive.ubuntu.com/ubuntu bionic-updates/restricted armhf Packages
Ign:36 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe armhf Packages
Ign:37 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse armhf Packages
Err:38 http://in.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
404 Not Found [IP: 2403:8940:ffff::f 80]
Ign:39 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Ign:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages
Ign:59 http://security.ubuntu.com/ubuntu bionic-security/universe armhf Packages
Ign:60 http://security.ubuntu.com/ubuntu bionic-security/multiverse armhf Packages
Ign:40 http://security.ubuntu.com/ubuntu bionic-security/main armhf Packages
Ign:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages
Ign:59 http://security.ubuntu.com/ubuntu bionic-security/universe armhf Packages
Ign:60 http://security.ubuntu.com/ubuntu bionic-security/multiverse armhf Packages
Ign:40 http://security.ubuntu.com/ubuntu bionic-security/main armhf Packages
Ign:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages
Ign:59 http://security.ubuntu.com/ubuntu bionic-security/universe armhf Packages
Ign:60 http://security.ubuntu.com/ubuntu bionic-security/multiverse armhf Packages
Err:40 http://security.ubuntu.com/ubuntu bionic-security/main armhf Packages
404 Not Found [IP: 2001:67c:1562::15 80]
Ign:47 http://security.ubuntu.com/ubuntu bionic-security/restricted armhf Packages
Ign:59 http://security.ubuntu.com/ubuntu bionic-security/universe armhf Packages
Ign:60 http://security.ubuntu.com/ubuntu bionic-security/multiverse armhf Packages
Fetched 252 kB in 5s (45.9 kB/s)
Reading package lists... Done
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic/main/binary-armhf/Packages 404 Not Found [IP: 2403:8940:ffff::f 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic-updates/main/binary-armhf/Packages 404 Not Found [IP: 2403:8940:ffff::f 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic-backports/main/binary-armhf/Packages 404 Not Found [IP: 2403:8940:ffff::f 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/main/binary-armhf/Packages 404 Not Found [IP: 2001:67c:1562::15 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
gp@guru-hp:~$
gp@guru-hp:~$ sudo apt-get install libi2c-dev:armhf
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libi2c-dev:armhf
gp@guru-hp:~$
我已经在 ubunt 包管理器站点中验证了 libi2c-dev 包的可用性。https://packages.ubuntu.com/bionic/libi2c-dev
答案1
armhf 包不在 universe 存储库中。我在http://ports.ubuntu.com
以下是我获取 4.0-2 版本所做的事情:
$ wget http://ports.ubuntu.com/pool/universe/i/i2c-tools/libi2c-dev_4.0-2_armhf.deb
$ sudo dpkg --force architecture --install ./libi2c-dev_4.0-2_armhf.deb
这确实会引发一条错误消息:
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: package architecture (armhf) does not match system (amd64)
(Reading database ... 52515 files and directories currently installed.)
Preparing to unpack ./libi2c-dev_4.0-2_armhf.deb ...
Unpacking libi2c-dev:armhf (4.0-2) over (4.0-2) ...
dpkg: dependency problems prevent configuration of libi2c-dev:armhf:
libi2c-dev:armhf depends on libi2c0 (= 4.0-2).
dpkg: error processing package libi2c-dev:armhf (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libi2c-dev:armhf
但它确实提供了所需的库,并将其放入文件系统中的合理位置,这样您的 amd64 主机就不会混乱。
安装完成后,我的引用-li2c的交叉编译项目链接正确。