From 1e045a5d5ca2e3e28119343970b2ccff13a64c65 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Sat, 26 Aug 2023 02:17:15 +0100 Subject: Rust/unit-wasm-sys: Don't require the wasi-sysroot When I added the luw_http_hdr_get_value() function I needed to include strings.h, unfortunately I added it to unit-wasm.h instead of libunit-wasm.c This then meant that we needed to point bindgen/clang, for generating the bindings, to the wasi-sysroot for the strings.h file. I guess this is a system dependant include or something and when we use the wasm32-wasi target in clang it uses a paired down include search path list, none of which have strings.h This then had the knock on effect of requiring to inform cargo build of the wasi-sysroot path. Now that we put strings.h in the right place, we don't need the wasi-sysroot when building the rust stuff. Signed-off-by: Andrew Clayton --- src/rust/unit-wasm-sys/build.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/rust/unit-wasm-sys/build.rs b/src/rust/unit-wasm-sys/build.rs index bd8d3a5..3d3ff0e 100644 --- a/src/rust/unit-wasm-sys/build.rs +++ b/src/rust/unit-wasm-sys/build.rs @@ -30,15 +30,12 @@ fn main() { } fn generate_bindings() { - let wasi_sysroot = - "--sysroot=".to_owned() + &env::var("WASI_SYSROOT").unwrap(); let bindings = bindgen::Builder::default() // The input header file. .header("libunit-wasm/include/unit/unit-wasm.h") .allowlist_function("^luw_.*") .allowlist_var("^luw_.*") .allowlist_type("^luw_.*") - .clang_args(vec![wasi_sysroot]) // Needed for strings.h .generate() .expect("Unable to generate bindings"); -- cgit