rust-bindgen
rust-bindgen copied to clipboard
renaming of the library `C` was specified, however this crate contains no `#[link(...)]` attributes referencing this library
Input C/C++ Header
I have no idea what causes the issue, and so I can't narrow it down, and also I'm not even sure if it's related to the header file https://github.com/NordicID/nur_sdk/blob/master/native/include/NurAPI.h
Bindgen Invocation
bindgen::Builder::default()
// blacklist a bunch of types and functions that hopefully will not be utilized
// https://github.com/rust-lang/rust-bindgen/issues/1556#issuecomment-658317813
.blocklist_type("LPMONITORINFOEXA?W?")
// ...
.blocklist_function("__C_specific_handler")
// The input header we would like to generate
// bindings for.
.header("wrapper.h")
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
// Finish the builder and generate the bindings.
.generate()
// Unwrap the Result and panic on failure.
.expect("Unable to generate bindings");
Actual Results
error: renaming of the library `C` was specified, however this crate contains no `#[link(...)]` attributes referencing this library
Expected Results
I expect it to successfully build.
I suspect my problem is probably related to
let root_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-lib={}", Path::new(&root_dir)
.join("NUR-lib")
.display());
// Tell cargo to invalidate the built crate whenever the wrapper changes
println!("cargo:rerun-if-changed=wrapper.h");
NUR-lib contains x86 and x64 from https://github.com/NordicID/nur_sdk/tree/master/native/windows
I cannot determine what causes the error though or where to even start looking for a fix, I don't understand the implications of this error message, nor have I found another issue related to it other than this.
Yeah this seems unlikely to be related to bindgen, bindgen intentionally doesn't mess with anything compiler-related, just generates code. That said, maybe the CargoCallbacks are causing trouble? That'd be a bit surprising but... Does removing that help?
If not, can you post some concrete steps to reproduce? Something like:
- clone this repo
- cargo build
- ...
Or so?
I commented the line
// .parse_callbacks(Box::new(bindgen::CargoCallbacks))
same error.
... can you post some concrete steps to reproduce?
Sure!
- clone this repo
- cargo build
- should err
I cloned the repo and tried building it. The linking error is no longer present. There's an error related to duplicated constants but it seems unrelated to this. Feel free to reopen.