raymanfx / libv4l-rs

Video4Linux2 bindings for Rust
MIT License
155 stars 65 forks source link

Build fail when features=libv4l #93

Closed dongfengweixiao closed 10 months ago

dongfengweixiao commented 10 months ago

Cargo.toml

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

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
v4l = { version = "0.14.0", features = ["libv4l"] }
cargo build -v
       Fresh glob v0.3.1
       Fresh unicode-ident v1.0.12
       Fresh proc-macro2 v1.0.78
       Fresh quote v1.0.35
       Fresh bitflags v2.4.2
       Fresh minimal-lexical v0.2.1
       Fresh linux-raw-sys v0.4.13
       Fresh memchr v2.7.1
       Fresh regex-syntax v0.8.2
       Fresh cfg-if v1.0.0
       Fresh rustix v0.38.30
       Fresh regex-automata v0.4.4
       Fresh nom v7.1.3
       Fresh libloading v0.8.1
       Fresh syn v2.0.48
       Fresh either v1.9.0
       Fresh home v0.5.9
       Fresh clang-sys v1.7.0
       Fresh which v4.4.2
       Fresh prettyplease v0.2.16
       Fresh cexpr v0.6.0
       Fresh regex v1.10.3
       Fresh shlex v1.3.0
       Fresh log v0.4.20
       Fresh lazy_static v1.4.0
       Fresh bitflags v1.3.2
       Fresh lazycell v1.3.0
       Fresh rustc-hash v1.1.0
       Fresh peeking_take_while v0.1.2
       Fresh bindgen v0.65.1
       Fresh libc v0.2.152
       Dirty v4l2-sys-mit v0.3.0: the file `target/debug/build/v4l2-sys-mit-86f56289e69f4dfe/out/v4l2_bindings.rs` has changed (1705912026.817375900s, 817375900ns after last build at 1705912026.000000000s)
   Compiling v4l2-sys-mit v0.3.0
       Dirty v4l-sys v0.3.0: the file `target/debug/build/v4l-sys-2fff74701d7ec040/out/libv4l_bindings.rs` has changed (1705912027.600018400s, 600018400ns after last build at 1705912027.000000000s)
   Compiling v4l-sys v0.3.0
     Running `/home/deehy/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name v4l2_sys_mit --edition=2018 /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l2-sys-mit-0.3.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=261 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=4ad9c7016295d975 -C extra-filename=-4ad9c7016295d975 --out-dir /mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps -L dependency=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps --cap-lints allow`
     Running `/home/deehy/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name v4l_sys --edition=2018 /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-sys-0.3.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=261 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=4a232513af6dbc6e -C extra-filename=-4a232513af6dbc6e --out-dir /mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps -L dependency=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps --cap-lints allow -l v4l1 -l v4l2 -l v4lconvert`
   Compiling v4l v0.14.0
     Running `/home/deehy/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name v4l --edition=2018 /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=261 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="libv4l"' --cfg 'feature="v4l-sys"' --cfg 'feature="v4l2"' --cfg 'feature="v4l2-sys"' -C metadata=8a2a37446c628d66 -C extra-filename=-8a2a37446c628d66 --out-dir /mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps -L dependency=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps --extern bitflags=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libbitflags-b7cee2ca4fb438d0.rmeta --extern libc=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/liblibc-a00c9f6be6c2f4ac.rmeta --extern v4l_sys=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libv4l_sys-4a232513af6dbc6e.rmeta --extern v4l2_sys=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libv4l2_sys_mit-4ad9c7016295d975.rmeta --cap-lints allow`
error[E0428]: the name `detail` is defined multiple times
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:59:1
   |
8  | mod detail {
   | ---------- previous definition of the module `detail` here
...
59 | mod detail {
   | ^^^^^^^^^^ `detail` redefined here
   |
   = note: `detail` must be defined only once in the type namespace of this module

error[E0252]: the name `v4l_sys` is defined multiple times
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/lib.rs:74:9
   |
71 | pub use v4l_sys;
   |         ------- previous import of the module `v4l_sys` here
...
74 | pub use v4l2_sys as v4l_sys;
   |         ^^^^^^^^^^^^^^^^^^^ `v4l_sys` reimported here
   |
   = note: `v4l_sys` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
   |
74 | pub use v4l2_sys as other_v4l_sys;
   |         ~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0425]: cannot find function `v4l2_open` in this scope
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:14:9
   |
14 |         v4l2_open(path, flags)
   |         ^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
9  +     use v4l_sys::v4l2_open;
   |

error[E0425]: cannot find function `v4l2_close` in this scope
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:17:9
   |
17 |         v4l2_close(fd)
   |         ^^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
9  +     use v4l_sys::v4l2_close;
   |

error[E0425]: cannot find function `v4l2_ioctl` in this scope
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:27:9
   |
27 |         v4l2_ioctl(
   |         ^^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
9  +     use v4l_sys::v4l2_ioctl;
   |

error[E0425]: cannot find function `v4l2_mmap` in this scope
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:44:9
   |
44 |         v4l2_mmap(
   |         ^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
9  +     use v4l_sys::v4l2_mmap;
   |

error[E0425]: cannot find function `v4l2_munmap` in this scope
  --> /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/v4l2/api.rs:54:9
   |
54 |         v4l2_munmap(start, length.try_into().expect("usize -> c size_t failed"))
   |         ^^^^^^^^^^^ not found in this scope
   |
help: consider importing this function
   |
9  +     use v4l_sys::v4l2_munmap;
   |

Some errors have detailed explanations: E0252, E0425, E0428.
For more information about an error, try `rustc --explain E0252`.
error: could not compile `v4l` (lib) due to 7 previous errors

Caused by:
  process didn't exit successfully: `/home/deehy/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name v4l --edition=2018 /home/deehy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/v4l-0.14.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=261 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="libv4l"' --cfg 'feature="v4l-sys"' --cfg 'feature="v4l2"' --cfg 'feature="v4l2-sys"' -C metadata=8a2a37446c628d66 -C extra-filename=-8a2a37446c628d66 --out-dir /mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps -L dependency=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps --extern bitflags=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libbitflags-b7cee2ca4fb438d0.rmeta --extern libc=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/liblibc-a00c9f6be6c2f4ac.rmeta --extern v4l_sys=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libv4l_sys-4a232513af6dbc6e.rmeta --extern v4l2_sys=/mnt/c/Users/dongf/Source/Rust/v4l2_test/target/debug/deps/libv4l2_sys_mit-4ad9c7016295d975.rmeta --cap-lints allow` (exit status: 1)
MarijnS95 commented 10 months ago

You'll have to use default-features = false to disable the v4l2 feature. It's mutually exclusive with the libv4l feature.

Rust features are supposed to be additive but that isn't the most natural way to represent this XOR selection.

dongfengweixiao commented 10 months ago

You'll have to use default-features = false to disable the v4l2 feature. It's mutually exclusive with the libv4l feature.

Rust features are supposed to be additive but that isn't the most natural way to represent this XOR selection.

Thank you for your guidance.