so this is an issue i got from probably the most annoying bug I've had ever. i made a help thread on reddit but i think the only way to do it right is to post it here. I've been working on a software Dev project for a while now. I'm trying to cross-compile for the raspberry pi, but I've been having quite the issues with it.
the program is written in rust, which is pretty easy to cross-compile for. that is, so long as all your deps are written in rust. but i have one dep, v4l-rs
which is based of of the c/c++ lib video4linux2. when i cross compile, i install some dependencys (libv4l-dev libclang-11-dev gcc-arm-linux-gnueabihf
), and compile with the armv7
toolchain. but i get a strange error if i do that:
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
in an attempt to fix this issue, i posted another support request here. there are a few differences from when i made that support request until now, like I'm now using GitHub actions instead of cross-rs
, and I'm now using the armv7 instead of the aarch64 toolchain. but i still think that the solution will still work. one of the sugested solutions was to install the libv4l
and libclang
deps with armv7.
but that caused its own issues. i used this tutorial to coss-install the deps i need, and i made this script.
# 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
but this still failes. now i get this error:
| 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.
I'm stumped at this point. what does not installable
mean? why is it not installable?
more info in case its relevent:
- im makeing a github action, and testing it with act.
- i cant compile it on the pi itself because its a large project, and that would take forever.
- my gh action has not been pushed to the dev branch yet, so the one thats already there as very out of date.
- armv7-unknown-linux-gnueabihf is the right toolchain for rpi4 right?