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

Compile issues on v4l2_pix_format in linux kernel 6.2 #147

Open
chriamue opened this issue Oct 13, 2023 · 3 comments
Open

Compile issues on v4l2_pix_format in linux kernel 6.2 #147

chriamue opened this issue Oct 13, 2023 · 3 comments

Comments

@chriamue
Copy link

On kernel Linux 6.2.0-34-generic or maybe already earlier, v4l2 introduced unions, which does not work with v4l2-sys-mit = "0.2":

/*
 *      V I D E O   I M A G E   F O R M A T
 */
struct v4l2_pix_format {
        __u32                   width;
        __u32                   height;
        __u32                   pixelformat;
        __u32                   field;          /* enum v4l2_field */
        __u32                   bytesperline;   /* for padding, zero if unused */
        __u32                   sizeimage;
        __u32                   colorspace;     /* enum v4l2_colorspace */
        __u32                   priv;           /* private data, depends on pixelformat */
        __u32                   flags;          /* format flags (V4L2_PIX_FMT_FLAG_*) */
        union {
                /* enum v4l2_ycbcr_encoding */
                __u32                   ycbcr_enc;
                /* enum v4l2_hsv_encoding */
                __u32                   hsv_enc;
        };
        __u32                   quantization;   /* enum v4l2_quantization */
        __u32                   xfer_func;      /* enum v4l2_xfer_func */
};

So I get this compile error like this:

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

Caused by:
  process didn't exit successfully: `/home/chriamue/temp/test_v4l/target/debug/build/v4l2-sys-mit-ca66454ad2257fe1/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /home/chriamue/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.69/src/fallback.rs:817:9:
  "v4l2_pix_format_union_(anonymous_at_/usr/include/linux/videodev2_h_500_2)" is not a valid Ident
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Upgrading to

[target.'cfg(target_os="linux")'.dependencies]
v4l = "0.14"
v4l2-sys-mit = "0.3"

allows to compile.

Please upgrade in nokhwa-bindings-linux if possible.

@ripytide
Copy link

ripytide commented Feb 8, 2024

Fixed by the as yet unmerged PR #156

@faern
Copy link

faern commented Feb 25, 2024

What's the status on this issue? It's still broken for me on Fedora 39.

@Skgland
Copy link

Skgland commented Feb 26, 2024

I think this might be fixed since f140541 8 month ago as that contains the dependency upgrade from #156 mentioned by ripytide in #147 (comment) , but the last release is 10 month old. So I think we might be just waiting for a new release of the 0.10 branch.

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

4 participants