Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to run custom build command for v4l2-sys-mit v0.2.0 #174

Open
zxcqirara opened this issue Jun 3, 2024 · 1 comment
Open

failed to run custom build command for v4l2-sys-mit v0.2.0 #174

zxcqirara opened this issue Jun 3, 2024 · 1 comment

Comments

@zxcqirara
Copy link

zxcqirara commented Jun 3, 2024

Just created a new project, added this lib and tried to compile it. It throws this error:

error: failed to run custom build command for `v4l2-sys-mit v0.2.0`

Caused by:
  process didn't exit successfully: `/home/user/proj/target/debug/build/v4l2-sys-mit-844fdf7983ccc2a0/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.56.0/src/ir/context.rs:846:9:
  "v4l2_pix_format_union_(anonymous_at_/usr/sbin/__/lib64/gcc/aarch64-linux-gnu/14_1_0/__/__/__/__/aarch64-linux-gnu/include/linux/videodev2_h_500_2)" is not a valid Ident
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm on x64 linux (WSL) and trying to compile it for aarch64 linux
My Cargo.toml:

[package]
name = "proj"
version = "0.1.0"
edition = "2021"

[dependencies]
nokhwa = { version = "0.10.4", features = ["input-native", "output-threaded"] }
@zxcqirara zxcqirara changed the title Failed to find tool. Is aarch64-linux-gnu-gcc installed? failed to run custom build command for v4l2-sys-mit v0.2.0 Jun 4, 2024
@unwx
Copy link

unwx commented Jul 3, 2024

I encountered the same build failure. The root cause explained here: https://stackoverflow.com/a/76443281

I'm new to Rust, but it looks like:

  • The v4l crate updated its bindgen dependency from 0.59 to 0.65 to solve that problem: raymanfx/libv4l-rs@cf6d412
  • nokhwa updated its v4l dependency on June 4th, 2023: f140541
  • However, the latest nokhwa package on crates.io was updated on May 14th, 2023, and doesn't include this fix.

Workaround:

Building nokhwa from source (the 0.10 branch) resolved the issue for me.

Additional Notes:

On Fedora, I needed to install the following development packages for the build to succeed:

fontconfig-devel, alsa-lib-devel, libudev-devel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants