1 use pkg_config::Config; 2 main()3fn main() { 4 let target_dir = std::env::var_os("CARGO_TARGET_DIR").unwrap(); 5 println!("cargo:rustc-link-search=native={}", target_dir.into_string().unwrap()); 6 7 // When cross-compiling, pkg-config is looking for dbus at the host libdir instead of the 8 // sysroot. Adding this dependency here forces the linker to include the current sysroot's 9 // libdir and fixes the build issues. 10 Config::new().probe("dbus-1").unwrap(); 11 println!("cargo:rerun-if-changed=build.rs"); 12 } 13