Open froydnj opened 7 years ago
Or maybe an Option<ClangVersion>
, since libbindgen
appears to have its own notion of clang's version, for reasons that I do not understand.
Alternatively, after reading @fitzgen's explanation of bindgen, maybe bindgen itself should be doing the checking so that it catches configuration errors from the user.
We have https://github.com/servo/rust-bindgen/blob/a1e2029/bindgen/src/main.rs#L26-L43 for the bindgen
executable. It would be good to have something similar for libbindgen
as well, or to move that check into libbindgen
.
FWIW I did this in https://github.com/servo/rust-bindgen/pull/793 but then we started running into libclang dynamic loading bugs and I left it at that.
If someone wants to try again, they might find that PR helpful. Or maybe not, its not like its a lot of code.
I ran into some trouble testing build-time bindgen in Stylo today because I didn't realize I needed to set
CLANG_PATH
appropriately, and was getting nonsensical backtraces along with errors about undeclared identifiers in header files. I think it'd be good to add amin_version: Option<clang_sys::CXVersion>
toBindgenOptions
, whichBindings::generate
can then check against the returned version fromclang_sys::support::Clang::find()
, complaining if the version found isn't new enough, with a friendly error message. Then Stylo can provide the appropriate version and everybody can walk away happy.