-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix cross compilation #16
base: master
Are you sure you want to change the base?
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. |
build.rs
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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