Conversation
When executing build scripts, [cargo sets several environment variables](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts). Use the cargo-supplied value for `RUSTC`. This _also_ allows `libudev-sys` to be build by [bazel](https://bazel.build) using rules created by `cargo raze`. Signed-off-by: Chris Frantz <cfrantz@google.com>
|
The reason this has worked for many is due to libudev being installed correctly for the host, but if libudev is only available for the target, the old implementation fails. |
| if !output.status.success() { | ||
| println!( | ||
| "cargo:warning=Failed to compile test program for udev function `{}`", | ||
| function_name | ||
| ); | ||
| println!("cargo:warning=Using command`{:?}`", cmd); | ||
| println!( | ||
| "cargo:warning=stdout={}", | ||
| String::from_utf8_lossy(&output.stdout) | ||
| .trim() | ||
| .replace("\n", "\ncargo:warning=") | ||
| ); | ||
| println!( | ||
| "cargo:warning=stderr={}", | ||
| String::from_utf8_lossy(&output.stderr) | ||
| .trim() | ||
| .replace("\n", "\ncargo:warning=") | ||
| ); | ||
| false | ||
| } else { | ||
| true | ||
| } |
There was a problem hiding this comment.
this might be a bit noisy if the function is not expected to work. would be better if this crate instead of checking if udev_hwdb_new works, include hwdb unconditionally if feature flag hwdb is included, and let the normal rustc invocation fail linking
|
Thanks for this fix, it resolves I believe this can be resolved with an Can be tested with test project: https://github.com/tuna-f1sh/cross-udev-hwdb/tree/main |
|
fixed! @tuna-f1sh |
Fixes cross-rs/cross#1377
This fixes wrong assumptions done in the build script so that the correct link paths, linker and target are used.
includes #11