-
Notifications
You must be signed in to change notification settings - Fork 8
c library ssvmup build can not find <stdlib.h> #6
Comments
Hi @cs686, Thanks for your information. Unfortunately, the current version of wasm-bindgen/wasm32-wasi backend has some issues when linking rust application with C/C++ libraries. You can find more details in this issue( https://github.com/rustwasm/wasm-bindgen/pull/2209/files ). Currently, we don't have an easy solution for it. I've tried $ cargo build --target wasm32-wasi
Compiling libdeflate-sys v0.5.0
The following warnings were emitted during compilation:
warning: libdeflate/lib/aligned_malloc.c:36:10: fatal error: 'stdlib.h' file not found
warning: #include <stdlib.h>
warning: ^~~~~~~~~~
warning: 1 error generated.
error: failed to run custom build command for `libdeflate-sys v0.5.0`
Caused by:
process didn't exit successfully: `/home/hydai/workspace/wasm-learning/nodejs/libdeflater/target/release/build/libdeflate-sys-ec0c99f338ab6167/bui
ld-script-build` (exit code: 1)
--- stdout
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("3")
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("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-I" "libdeflate/" "-I" "libdeflate/lib/" "-I" "libdef
late/common/" "-o" "/home/hydai/workspace/wasm-learning/nodejs/libdeflater/target/wasm32-wasi/release/build/libdeflate-sys-ab91f28b9c57ff1b/out/lib/
libdeflate/lib/aligned_malloc.o" "-c" "libdeflate/lib/aligned_malloc.c"
cargo:warning=libdeflate/lib/aligned_malloc.c:36:10: fatal error: 'stdlib.h' file not found
cargo:warning=#include <stdlib.h>
cargo:warning= ^~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1
--- stderr
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-I" "libdeflate/" "-I" "libdeflate/lib
/" "-I" "libdeflate/common/" "-o" "/home/hydai/workspace/wasm-learning/nodejs/libdeflater/target/wasm32-wasi/release/build/libdeflate-sys-ab91f28b9c
57ff1b/out/lib/libdeflate/lib/aligned_malloc.o" "-c" "libdeflate/lib/aligned_malloc.c" with args "clang" did not execute successfully (status code exit code: 1). |
The sys C libraries often make operating system calls that are not permitted by the WebAssembly sandbox. WebAssembly only allows very limited number of system calls via the WASI interface. In this particular case, I would recommend to use a pure Rust implementation of deflate. |
@juntao thank,I will try |
I use libdeflate lib, but can not ssvmup build
The text was updated successfully, but these errors were encountered: