rust-lang / rust-lang/rust-bindgen
passing -print-search-dirs causes panic with no helpful message
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
I was trying to follow from where bindgen was pulling headers. I was suggested to pass the -print-search-dirs clang flag.
Unfortunately, this simply caused bindgen to panic, with a very generic error message. The backtrace also did not yield anything useful. This was on a Windows 10 system with LLVM 11 installed, and bindgen 0.56.0.
Bindgen Invocation
$ bindgen wrapper.h -- -print-search-dirs
Actual Results
Apologies for the screenshots, cannot copy-paste from a VM.


Backtrace on Linux, where the same thing happens:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: core::panicking::panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
2: core::option::expect_failed
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1226
3: bindgen::ir::context::BindgenContext::new
4: bindgen::Builder::generate
5: std::panicking::try
6: bindgen::main
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
Reproduce the panic with bindgen wrapper.h -- -print-search-dirs, on a setup using clang if available. Start at bindgen::ir::context::BindgenContext::new and follow the call from bindgen::Builder::generate; done means this invocation reports a useful error instead of panicking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100