所以这是我遇到过的最烦人的错误。我发了一个帮助帖子Reddit但我认为唯一正确的方法是将其发布在这里。我一直在从事软件开发项目 已经有一段时间了。我正在尝试为 raspberry pi 进行交叉编译,但遇到了很多问题。
该程序是用 rust 编写的,因此很容易进行交叉编译。也就是说,只要您的所有 dep 都是用 rust 编写的。但我有一个 dep,v4l-rs
它基于 c/c++ lib video4linux2。当我交叉编译时,我会安装一些依赖项(libv4l-dev libclang-11-dev gcc-arm-linux-gnueabihf
),并使用armv7
工具链进行编译。但如果我这样做,我会收到一个奇怪的错误:
error: failed to run custom build command for `v4l2-sys-mit v0.2.0`
Caused by:
process didn't exit successfully: `/home/makerio/projects/wificar/target/release/build/v4l2-sys-mit-e6f39e3cdb722d62/build-script-build` (exit status: 101)
--- stderr
/usr/include/linux/videodev2.h:60:10: fatal error: 'sys/time.h' file not found
/usr/include/linux/videodev2.h:60:10: fatal error: 'sys/time.h' file not found, err: true
thread 'main' panicked at 'Failed to generate bindings: ()', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/v4l2-sys-mit-0.2.0/build.rs:10:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
为了修复这个问题,我又发了一条支持请求这里。从我提出支持请求到现在有一些不同,比如我现在使用 GitHub 操作而不是cross-rs
,我现在使用 armv7 而不是 aarch64 工具链。但我仍然认为该解决方案仍然有效。建议的解决方案之一是安装带有 armv7 的libv4l
和libclang
deps。
但这本身也会引起问题。我用这教程来安装我需要的 deps,并且我制作了这个脚本。
# add arch
dpkg --add-architecture armhf
# create the sources list
sudo touch /etc/apt/sources.list.d/arm-cross-compile-sources.list
# move the list to there
sudo cp ./scripts/arm-cross-compile-sources.list /etc/apt/sources.list.d/arm-cross-compile-sources.list
# dont use the existing sources
sed "s/deb/deb [arch=amd64]/" /etc/apt/sources.list | sudo tee /etc/apt/sources.list
sudo apt update
# install the packages
sudo apt install -y libv4l-dev:armhf libclang-11-dev:armhf gcc-arm-linux-gnueabihf
但这仍然失败。现在我收到此错误:
| 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:
| libasan5:armhf : Depends: libc6:armhf (>= 2.28) but it is not installable
| Depends: libgcc-s1:armhf but it is not installable
| libclang-common-11-dev:armhf : Depends: libc6:armhf (>= 2.17) but it is not installable
| Depends: libgcc-s1:armhf (>= 4.3) but it is not installable
| Depends: libstdc++6:armhf (>= 4.1.1) but it is not installable
| libclang1-11:armhf : Depends: libc6:armhf (>= 2.4) but it is not installable
| Depends: libgcc-s1:armhf (>= 3.5) but it is not installable
| Depends: libstdc++6:armhf (>= 9) but it is not installable
| libffi7:armhf : Depends: libc6:armhf (>= 2.7) but it is not installable
| Depends: libgcc-s1:armhf (>= 3.5) but it is not installable
| libgc1c2:armhf : Depends: libc6:armhf (>= 2.28) but it is not installable
| Depends: libgcc-s1:armhf (>= 3.5) but it is not installable
| Depends: libstdc++6:armhf (>= 4.3.0) but it is not installable
| libgcc-9-dev:armhf : Depends: libgcc-s1:armhf (>= 9.4.0-1ubuntu1~20.04.1) but it is not installable
| Depends: libgomp1:armhf (>= 9.4.0-1ubuntu1~20.04.1) but it is not going to be installed
| Depends: libatomic1:armhf (>= 9.4.0-1ubuntu1~20.04.1) but it is not going to be installed
| Depends: libubsan1:armhf (>= 9.4.0-1ubuntu1~20.04.1) but it is not going to be installed
| Recommends: libc6-dev:armhf (>= 2.13-0ubuntu6) but it is not going to be installed
| libllvm11:armhf : Depends: libc6:armhf (>= 2.29) but it is not installable
| Depends: libedit2:armhf (>= 2.11-20080614-0) but it is not going to be installed
| Depends: libgcc-s1:armhf (>= 4.3) but it is not installable
| Depends: libstdc++6:armhf (>= 9) but it is not installable
| Depends: libtinfo6:armhf (>= 6) but it is not going to be installed
| Depends: zlib1g:armhf (>= 1:1.2.0) but it is not installable
| libobjc4:armhf : Depends: libc6:armhf (>= 2.4) but it is not installable
| Depends: libgcc-s1:armhf (>= 3.5) but it is not installable
| libstdc++-9-dev:armhf : Depends: libstdc++6:armhf (>= 9.4.0-1ubuntu1~20.04.1) but it is not installable
| Depends: libc6-dev:armhf (>= 2.13-0ubuntu6) but it is not going to be installed
| libv4l-0:armhf : Depends: libc6:armhf (>= 2.27) but it is not installable
| libv4l2rds0:armhf : Depends: libc6:armhf (>= 2.4) but it is not installable
| libv4lconvert0:armhf : Depends: libc6:armhf (>= 2.27) but it is not installable
| Depends: libjpeg8:armhf (>= 8c) but it is not going to be installed
| E: Unable to correct problems, you have held broken packages.
我现在很困惑。这是什么not installable
意思?为什么无法安装?
更多信息(如果相关):
- 我正在做一个 github 动作,并用它测试行为。
- 我无法在 pi 上编译它,因为它是一个大型项目,而且会花费很长时间。
- 我的 gh 操作尚未推送到 dev 分支,因此已经存在的操作已经过时了。
- armv7-unknown-linux-gnueabihf 是 rpi4 的正确工具链,对吗?