diff --git a/build.rs b/build.rs index 4853d36..6026fe4 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,7 @@ #[cfg(not(feature = "bindgen"))] -fn main() {} +fn main() { + println!("cargo::rustc-check-cfg=cfg(io_uring_skip_arch_check)"); +} #[cfg(feature = "bindgen")] fn main() { diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 652ba7c..f7f1b5a 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -33,6 +33,15 @@ fn to_result(ret: c_int) -> io::Result { } } +#[cfg(all( + not(feature = "bindgen"), + not(target_arch = "x86_64"), + not(io_uring_skip_arch_check) +))] +compile_error!("The prebuilt `sys.rs` may not be compatible with your target, +please use bindgen feature to generate new `sys.rs` of your arch +or use `--cfg=io_uring_skip_arch_check` to skip the check."); + #[cfg(all(feature = "bindgen", not(feature = "overwrite")))] include!(concat!(env!("OUT_DIR"), "/sys.rs"));