rust-lang / rust-lang/rust-bindgen
Odd issue with include paths and wasm32-wasi target because .h file gets detected as C rather than C++
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
I apologize for not having a minimal reproduction but I honestly have no idea what is going on here. I am having to add these lines to my build script to make it work:
Without those lines, I see the following output:
--- stderr
clang version 11.0.0
Target: wasm32-unknown-wasi
Thread model: posix
InstalledDir:
ignoring nonexistent directory "C:\MSFS SDK\/WASM/wasi-sysroot/include/wasm32-wasi/c++/v1"
ignoring nonexistent directory "lib\clang\11.0.0\include"
ignoring nonexistent directory "C:\MSFS SDK\/WASM/wasi-sysroot/include/wasm32-wasi"
ignoring duplicate directory "C:\MSFS SDK\/WASM/wasi-sysroot/include"
#include "..." search starts here:
#include <...> search starts here:
./airbus-fbw-bench/src-model/src
C:\Program Files\LLVM\lib\clang\11.0.0\include
C:\MSFS SDK\/WASM/wasi-sysroot/include
C:\MSFS SDK\/WASM/wasi-sysroot/include/c++/v1
End of search list.
C:\MSFS SDK\/WASM/wasi-sysroot/include/c++/v1\cstddef:44:15: fatal error: 'stddef.h' file not found
C:\MSFS SDK\/WASM/wasi-sysroot/include/c++/v1\cstddef:44:15: fatal error: 'stddef.h' file not found, err: true
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', build.rs:58:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked build.rs lines 47-50 and the failure at line 58, then reproduce the wasm32-unknown-wasi build while inspecting clang's include search paths. The report lacks a minimal reproduction, so first isolate how bindgen handles the .h input and C++ include paths. Done means the target finds the required headers without the workaround and the original build succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100