rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

passing -print-search-dirs causes panic with no helpful message

Open LunarLambda opened this issue 4 years ago • 1 comments

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.

image

image

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

LunarLambda avatar Dec 24 '20 21:12 LunarLambda

This is still an issue, in the meantime, you can use ParseCallbacks::include_file to check which files are included.

pvdrz avatar Aug 14 '23 20:08 pvdrz