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

Rust examples fail to build in local environment #21079

Open
mguetschow opened this issue Dec 13, 2024 · 0 comments
Open

Rust examples fail to build in local environment #21079

mguetschow opened this issue Dec 13, 2024 · 0 comments
Assignees

Comments

@mguetschow
Copy link
Contributor

Description

On my local environment, installed according to the documentation (see Versions below), I am unable to build any of the three Rust examples. Tested for native, native64 and nrf52840dk on current master.

The build works fine using BUILD_IN_DOCKER=1, where the Rust versions are listed below as well.

Steps to reproduce the issue

$ make -C examples/rust-hello-world BOARD=native clean all
...
  C2Rust binary c2rust, version: C2Rust 0.19.0
  Running C2Rust on /home/mikolai/TUD/Code/RIOT-build/examples/rust-hello-world/bin/native/target/i686-unknown-linux-gnu/release/build/riot-sys-bc2f2079a2410180/out/compile_commands.json
  Transpiling riot-c2rust.h
  cargo:warning=C2Rust failed with error code exit status: 101, exiting

  --- stderr
  riot-c2rust.h:273:33: error: expected expression
      int result = LED0_IS_PRESENT;
                                  ^
  riot-c2rust.h:308:33: error: expected expression
      int result = LED1_IS_PRESENT;
                                  ^
  2 errors generated.
  Error while processing /home/mikolai/TUD/Code/RIOT-build/examples/rust-hello-world/bin/native/target/i686-unknown-linux-gnu/release/build/riot-sys-bc2f2079a2410180/out/riot-c2rust.h.
  thread 'main' panicked at /home/mikolai/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.92/src/lib.rs:849:13:
  unsupported proc macro punctuation character '('
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

(the concrete problem here is likely that the macro is actually an empty define)

$ make -C examples/rust-hello-world BOARD=nrf52840dk clean all
...
  C2Rust binary c2rust, version: C2Rust 0.19.0
  Running C2Rust on /home/mikolai/TUD/Code/RIOT-build/examples/rust-hello-world/bin/nrf52840dk/target/thumbv7em-none-eabihf/release/build/riot-sys-61ecc0f43debd7a2/out/compile_commands.json
  Transpiling riot-c2rust.h
  cargo:warning=C2Rust failed with error code exit status: 101, exiting

  --- stderr
  In file included from riot-c2rust.h:80:
  /home/mikolai/TUD/Code/RIOT-build/sys/include/vfs.h:59:10: fatal error: 'sys/statvfs.h' file not found
  #include <sys/statvfs.h> /* for struct statvfs */
           ^~~~~~~~~~~~~~~
  1 error generated.
  Error while processing /home/mikolai/TUD/Code/RIOT-build/examples/rust-hello-world/bin/nrf52840dk/target/thumbv7em-none-eabihf/release/build/riot-sys-61ecc0f43debd7a2/out/riot-c2rust.h.
  thread 'main' panicked at /home/mikolai/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.92/src/lib.rs:849:13:
  unsupported proc macro punctuation character '('
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

(no idea where this comes from)

Versions

Local environment

rustc 1.83.0 (90b35a623 2024-11-26)
C2Rust 0.19.0

Docker environment

rustc 1.81.0 (eeb90cda1 2024-09-04)
C2Rust 0.19.0
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