]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Set the C target to wasm32-wasi rather than wasm32
authorMatt Corallo <git@bluematt.me>
Sat, 24 Dec 2022 18:14:37 +0000 (18:14 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 3 Jan 2023 22:41:59 +0000 (22:41 +0000)
We need at least a partial C stdlib anyway, so there's no real
difference going ahead and linking wasm32-wasi on the C side vs
only on the Rust side. This fixes compilation on Debian testing
with OS packages installed.

genbindings.sh

index 4f795030f9301534010a6fec9729ec6c7df4d974..f26ea5d38057ca2c81813a9ef3f2cf8da954d50f 100755 (executable)
@@ -509,9 +509,9 @@ if [ "$2" = "false" -a "$(rustc --print target-list | grep wasm32-wasi)" != "" ]
        echo "int main() {}" > genbindings_wasm_test_file.c
        if clang -nostdlib -o /dev/null --target=wasm32-wasi -Wl,--no-entry genbindings_wasm_test_file.c > /dev/null 2>&1; then
                # And if it does, build a WASM binary without capturing errors
-               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -target wasm32 -O1"
+               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -target wasm32-wasi -O1"
                RUSTFLAGS="$BASE_RUSTFLAGS -C opt-level=1 --cfg=test_mod_pointers" cargo build $CARGO_BUILD_ARGS -v --target=wasm32-wasi
-               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -fembed-bitcode -target wasm32 -Oz"
+               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -fembed-bitcode -target wasm32-wasi -Oz"
                RUSTFLAGS="$BASE_RUSTFLAGS -C embed-bitcode=yes -C opt-level=z -C linker-plugin-lto -C lto" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target=wasm32-wasi
        else
                echo "Cannot build WASM lib as clang does not seem to support the wasm32-wasi target"