eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

build.rs erroneous target OS check during cross-compilation #186

Closed apinlt closed 2 years ago

apinlt commented 2 years ago

My use case is cross-compiling this crate for linux on a macOS host machine. This check in the crate's build.rs erroneously uses the cargo cfg attribute which is based on the host system in a build script, instead of the target system.

// Filters are extracted from `libc` filters
#[cfg(not(any(target_os = "android", target_os = "linux", target_os = "l4re",)))]
compile_error!("Building procfs on an for a unsupported platform. Currently only linux and android are supported")

Could this condition instead check the CARGO_CFG_TARGET_OS environment variable which should correctly report the target system OS during a build script?

eminence commented 2 years ago

Ahh, I've been tripped up by this before. Thanks for reporting, I've just opened #187 to fix this

eminence commented 2 years ago

The fix for this is now published in version v0.14.0