我正在尝试在我的 intel x64 22.04 机器上交叉编译 arm64 代码。我安装了 g++-aarch64-linux-gnu 编译器,现在我可以编译类似“hello world”的应用程序了。
除此之外,我还需要 arm64 的开发库(libcurl4-openssl-dev 就是其中之一)。为此,我运行了:
sudo dpkg --add-architecture arm64
进而:
sudo apt update
我得到下面的错误。我做错了什么?当然,这个故障阻止我安装 libcurl4-openssl-dev:amd64
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy-updates/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy-backports/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
这是整个输出
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Ign:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
Get:4 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,109 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [207 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1,313 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages [900 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages [900 kB]
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Ign:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
Get:12 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Get:13 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Ign:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
Get:14 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,395 kB]
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Ign:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
Get:16 http://us.archive.ubuntu.com/ubuntu jammy/main Translation-en [510 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 c-n-f Metadata [30.3 kB]
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Get:19 http://us.archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [129 kB]
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Get:20 http://us.archive.ubuntu.com/ubuntu jammy/restricted Translation-en [18.6 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu jammy/restricted amd64 c-n-f Metadata [488 B]
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Ign:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Get:23 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [14.1 MB]
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Err:3 http://security.ubuntu.com/ubuntu jammy-security/main arm64 Packages
404 Not Found [IP: 91.189.91.82 80]
Ign:7 http://security.ubuntu.com/ubuntu jammy-security/restricted arm64 Packages
Ign:10 http://security.ubuntu.com/ubuntu jammy-security/universe arm64 Packages
Ign:11 http://security.ubuntu.com/ubuntu jammy-security/multiverse arm64 Packages
Get:24 http://us.archive.ubuntu.com/ubuntu jammy/universe Translation-en [5,652 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 c-n-f Metadata [286 kB]
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Get:27 http://us.archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [217 kB]
Get:28 http://us.archive.ubuntu.com/ubuntu jammy/multiverse Translation-en [112 kB]
Get:29 http://us.archive.ubuntu.com/ubuntu jammy/multiverse amd64 c-n-f Metadata [8,372 B]
Get:30 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,325 kB]
Ign:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
Get:32 http://us.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [267 kB]
Get:33 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 c-n-f Metadata [16.1 kB]
Get:34 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1,342 kB]
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Get:36 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [220 kB]
Get:37 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 c-n-f Metadata [520 B]
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Get:39 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,036 kB]
Get:40 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [232 kB]
Get:41 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 c-n-f Metadata [22.1 kB]
Get:42 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [42.1 kB]
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Get:44 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse Translation-en [10.1 kB]
Get:45 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 c-n-f Metadata [472 B]
Get:46 http://us.archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [41.7 kB]
Ign:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
Get:48 http://us.archive.ubuntu.com/ubuntu jammy-backports/main Translation-en [10.5 kB]
Get:49 http://us.archive.ubuntu.com/ubuntu jammy-backports/main amd64 c-n-f Metadata [388 B]
Get:50 http://us.archive.ubuntu.com/ubuntu jammy-backports/restricted amd64 c-n-f Metadata [116 B]
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Get:52 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [24.2 kB]
Get:53 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe Translation-en [16.5 kB]
Get:54 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [644 B]
Get:55 http://us.archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
Ign:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Ign:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Ign:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Ign:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Ign:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Ign:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Ign:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Ign:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Ign:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Ign:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Ign:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Ign:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Err:15 http://us.archive.ubuntu.com/ubuntu jammy/main arm64 Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:18 http://us.archive.ubuntu.com/ubuntu jammy/restricted arm64 Packages
Ign:22 http://us.archive.ubuntu.com/ubuntu jammy/universe arm64 Packages
Ign:26 http://us.archive.ubuntu.com/ubuntu jammy/multiverse arm64 Packages
Err:31 http://us.archive.ubuntu.com/ubuntu jammy-updates/main arm64 Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:35 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted arm64 Packages
Ign:38 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe arm64 Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse arm64 Packages
Err:47 http://us.archive.ubuntu.com/ubuntu jammy-backports/main arm64 Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:51 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe arm64 Packages
Fetched 27.7 MB in 10s (2,856 kB/s)
Reading package lists... Done
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.82 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy-updates/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jammy-backports/main/binary-arm64/Packages 404 Not Found [IP: 91.189.91.38 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
答案1
我最终将 [arch=amd64] 添加到 /etc/apt/sources.list 中的所有条目中,然后添加来自 arm64 机器的 arch=arm64 的条目:
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse
糟糕的解决方案,但是有效。
谢谢,guiverc。