I'm not sure how to handle that on wasm. Probably put it behind a conditional compilation block, to not use alloca.
I think compilation failing would still be a blocker, since the crate will still be compiled.
โ alloca-rs git:(main) cargo build --target=wasm32-wasi
Downloaded cc v1.0.66
Downloaded 1 crate (53.5 KB) in 1.23s
Compiling cc v1.0.66
Compiling alloca v0.3.3 (/home/pascal/LinuxData/Development/alloca-rs)
The following warnings were emitted during compilation:
warning: In file included from alloca_.c:2:
warning: /usr/lib/clang/15.0.7/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
warning: #include_next <inttypes.h>
warning: ^~~~~~~~~~~~
warning: 1 error generated.
error: failed to run custom build command for `alloca v0.3.3 (/home/pascal/LinuxData/Development/alloca-rs)`
Caused by:
process didn't exit successfully: `/home/pascal/LinuxData/Development/alloca-rs/target/debug/build/alloca-3a7601d31ad37651/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("wasm32-wasi")
HOST = Some("x86_64-unknown-linux-gnu")
CC_wasm32-wasi = None
CC_wasm32_wasi = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-wasi = None
CFLAGS_wasm32_wasi = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
running: "clang" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-wasi" "-Wall" "-Wextra" "-o" "/home/pascal/LinuxData/Development/alloca-rs/target/wasm32-wasi/debug/build/alloca-7637b6b4aaef8e8b/out/alloca_.o" "-c" "alloca_.c"
cargo:warning=In file included from alloca_.c:2:
cargo:warning=/usr/lib/clang/15.0.7/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
cargo:warning=#include_next <inttypes.h>
cargo:warning= ^~~~~~~~~~~~
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "clang" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-wasi" "-Wall" "-Wextra" "-o" "/home/pascal/LinuxData/Development/alloca-rs/target/wasm32-wasi/debug/build/alloca-7637b6b4aaef8e8b/out/alloca_.o" "-c" "alloca_.c" with args "clang" did not execute successfully (status code exit status: 1).