Skip to content

Require libclang 9.0 or newer #2932

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

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bindgen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,18 @@ impl Bindings {
) -> Result<Bindings, BindgenError> {
ensure_libclang_is_loaded();

#[cfg(feature = "runtime")]
match clang_sys::get_library().unwrap().version() {
None => {
warn!("Could not detect a Clang version, make sure you are using libclang 9 or newer");
}
Some(version) => {
if version < clang_sys::Version::V9_0 {
warn!("Detected Clang version {version:?} which is unsupported and can cause invalid code generation, use libclang 9 or newer");
}
}
}

#[cfg(feature = "runtime")]
debug!(
"Generating bindings, libclang at {}",
Expand Down
2 changes: 1 addition & 1 deletion book/src/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This page lists the requirements for running `bindgen` and how to get them.
`bindgen` leverages `libclang` to preprocess, parse, and type check C and C++
header files.

It is required to use Clang 5.0 or greater.
It is required to use Clang 9.0 or greater.

### Installing Clang

Expand Down