Apt
在 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 添加到我的系統以進行交叉編譯?
這裡有兩個問題。
首先,要修復您在下載時收到的警告,您需要限定所有非埠條目
/etc/apt/sources.list
和./etc/apt/sources.list.d``[arch=amd64,i386]
其次,您不能
libudev1
使用目前設置進行安裝,因為在所有架構上都需要使用相同版本安裝多架構軟體包。您已經在 上安裝了 204-5ubuntu20.20amd64
,但該版本在您配置的儲存庫中不可用。為了能夠為 安裝包,armhf
您還需要添加:trusty-updates``armhf
deb [arch=armel,armhf] http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe