在 x64 Ubuntu 上为 arm 安装 libudev

在 x64 Ubuntu 上为 arm 安装 libudev

arm-linux-gnueabihf-g++我正在尝试在我的 x64 Ubuntu 上交叉编译一个软件。我尝试执行以下步骤来安装libudev:armhf

sudo dpkg --add-architecture armhf

将这两行添加到/etc/apt/sources.list

deb [arch=amd64,i386] http://uk.archive.ubuntu.com/ubuntu/ trusty main universe
deb [arch=armel,armhf] http://ports.ubuntu.com/ubuntu-ports trusty main universe`

然后我跑了:

sudo apt-get update

它给了我这样的错误:

W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/trusty/Release  Unable to find expected entry 'main/binary-armel/Packages' in Release file (Wrong sources.list entry or malformed file)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-armhf/Packages  404  Not Found [IP: 91.189.88.162 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-armhf/Packages  404  Not Found [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/multiverse/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/main/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/restricted/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/multiverse/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/restricted/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/multiverse/binary-armhf/Packages  404  Not Found [IP: 91.189.88.161 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

如果我尝试sudo apt-get install libudev-dev:armhf我得到

The following packages have unmet dependencies:


   libudev-dev:armhf : Depends: libudev1:armhf (= 204-5ubuntu20) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

sudo apt-cache policy libudev1:{amd64,armhf}给出

libudev1:
  Installed: 204-5ubuntu20.20
  Candidate: 204-5ubuntu20.20
  Version table:
 *** 204-5ubuntu20.20 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     204-5ubuntu20 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        500 http://uk.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libudev1:armhf:
  Installed: (none)
  Candidate: 204-5ubuntu20
  Version table:
     204-5ubuntu20 0
        500 http://ports.ubuntu.com/ubuntu-ports/ trusty/main armhf Packages

如何将armhf添加到我的系统中以进行交叉编译?

答案1

这里有两个问题。

首先,要解决下载时收到的警告,您需要获得资格全部中的非端口条目和中/etc/apt/sources.list的文件。/etc/apt/sources.list.d[arch=amd64,i386]

其次,您无法libudev1使用当前的设置进行安装,因为多架构软件包需要在所有架构上安装相同的版本。您已在 上安装了 204-5ubuntu20.20 amd64,但该版本在您配置的存储库中不可用。为了能够安装 for 的软件包armhf,您还需要添加trusty-updatesfor armhf

deb [arch=armel,armhf] http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe

答案2

为什么需要 ubuntu-ports? trusty官方档案里好像有armhf,参见:https://launchpad.net/ubuntu/+source/systemd/204-5ubuntu20.20

我建议删除您添加的行/etc/apt/sources.list并重试

相关内容