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

Naming confliction when using esp32-camera as extra component #513

Closed
ethe opened this issue Feb 2, 2025 · 2 comments
Closed

Naming confliction when using esp32-camera as extra component #513

ethe opened this issue Feb 2, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@ethe
Copy link

ethe commented Feb 2, 2025

Bug description

  1. git clone https://github.com/espressif/esp32-camera.git to components folder
  2. specify extra component in Cargo.toml:
[[package.metadata.esp-idf-sys.extra_components]]
component_dirs = ["components"]
bindings_header = "src/bindings.h"
  1. build
❯ cargo build --release
   Compiling esp-idf-sys v0.36.1
   Compiling esp-idf-hal v0.45.2
   Compiling esp-idf-svc v0.51.0
   Compiling esp-rs v0.1.0 (/Users/gwo/Idea/esp-rs)
error[E0530]: function parameters cannot shadow statics
  --> /Users/gwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-hal-0.45.2/src/adc.rs:70:13
   |
3  | use esp_idf_sys::*;
   |     -------------- the static `resolution` is imported here
...
70 |     fn from(resolution: Resolution) -> Self {
   |             ^^^^^^^^^^ cannot be named the same as a static

error[E0530]: function parameters cannot shadow statics
  --> /Users/gwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/esp-idf-hal-0.45.2/src/can.rs:93:17
   |
65 |     use esp_idf_sys::*;
   |         -------------- the static `resolution` is imported here
...
93 |         fn from(resolution: Timing) -> Self {
   |                 ^^^^^^^^^^ cannot be named the same as a static

For more information about this error, try `rustc --explain E0530`.
error: could not compile `esp-idf-hal` (lib) due to 2 previous errors

Expected behavior

Build pass

Environment

[[package]]
name = "esp-idf-hal"
version = "0.45.2"
@ethe ethe added the bug Something isn't working label Feb 2, 2025
@github-project-automation github-project-automation bot moved this to Todo in esp-rs Feb 2, 2025
@Vollbrecht
Copy link
Collaborator

We by default do not modularise the imports, but put everything into one big bindgen.rs file. If you know import something that is defined with the same name in two different headers that are distinct you get an error like this, For extra components i would suggest to import it as a seperate module. E.g make it available under esp_idf_sys::camera so it does not conflict. The description how you can do it is found here E.g the bindings_module definition.

@ethe
Copy link
Author

ethe commented Feb 3, 2025

bindings_module solved this, thanks

@ethe ethe closed this as completed Feb 3, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants