Error: renaming of the library `hpdfcargo` was specified, however this crate contains no `#[link(...)]` attributes referencing this library

โš“ Rust    ๐Ÿ“… 2025-08-06    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 7      

surdeus

Warning

This post was published 31 days ago. The information described in this article may have changed.

I am trying to generate bindings for libharu using bindgen, following the exact procedure mentioned on the website. Hereโ€™s my build.rs file

use std::{env, path::PathBuf};

fn main()
{
    println!("cargo::rustc-link-search=/usr/local/lib");
    print!("cargo::rustc-link-lib=static=hpdf");

    let bindings = bindgen::Builder::default()
        .header("src/libharu/libharu.h")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
        .generate()
        .expect("Unable to generate libharu bindings\n");

    let out = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings.write_to_file(out.join("bindings.rs")).unwrap();
}

However, if I run `cargo run` I get this error. I do know that there are bindings available on crates.io. However, I want to use the newer version of libharu.

1 post - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed