briansmith/ring

Does ring support the new WASI triples?

Closed this issue · 3 comments

I read #1921, but the current WASI triples are mainly wasm32-wasip1 and wasm32-wasip2, not wasm32-wasi. These triples cause compilation failures (as shown below).

   Compiling ring v0.17.8
warning: ring@0.17.8: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-wasip2"'
warning: ring@0.17.8: 1 error generated.
error: failed to run custom build command for `ring v0.17.8`

Caused by:
process didn't exit successfully: /private/tmp/ex/example/target/release/build/ring-9263422c07f84357/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
OPT_LEVEL = Some(3)
OUT_DIR = Some(/private/tmp/ex/example/target/wasm32-wasip2/release/build/ring-6ad973c36bee25aa/out)
TARGET = Some(wasm32-wasip2)
HOST = Some(aarch64-apple-darwin)
cargo:rerun-if-env-changed=CC_wasm32-wasip2
CC_wasm32-wasip2 = None
cargo:rerun-if-env-changed=CC_wasm32_wasip2
CC_wasm32_wasip2 = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
cargo:rerun-if-env-changed=WASI_SYSROOT
WASI_SYSROOT = None
DEBUG = Some(false)
cargo:rerun-if-env-changed=CFLAGS_wasm32-wasip2
CFLAGS_wasm32-wasip2 = None
cargo:rerun-if-env-changed=CFLAGS_wasm32_wasip2
CFLAGS_wasm32_wasip2 = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-wasip2"'
cargo:warning=1 error generated.

--- stderr

error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fno-exceptions" "--target=wasm32-wasip2" "-I" "include" "-I" "/private/tmp/ex/example/target/wasm32-wasip2/release/build/ring-6ad973c36bee25aa/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-nostdlibinc" "-DNDEBUG" "-DRING_CORE_NOSTDLIBINC=1" "-o" "/private/tmp/ex/example/target/wasm32-wasip2/release/build/ring-6ad973c36bee25aa/out/fad98b632b8ce3cc-curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args clang did not execute successfully (status code exit status: 1).

What could be wrong?

error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fno-exceptions" "--target=wasm32-wasip2" "-I" "include" "-I" "/private/tmp/ex/example/target/wasm32-wasip2/release/build/ring-6ad973c36bee25aa/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-nostdlibinc" "-DNDEBUG" "-DRING_CORE_NOSTDLIBINC=1" "-o" "/private/tmp/ex/example/target/wasm32-wasip2/release/build/ring-6ad973c36bee25aa/out/fad98b632b8ce3cc-curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args clang did not execute successfully (status code exit status: 1).

It looks like you need to upgrade to a version of clang that supports wasm32-wasip2?

Does ring support the new WASI triples?

AFAICT the new WASI triples are the same as the old ones, as far as ring is concerned, because we only use one API. It would be good to have this tested/verified in CI, though.

PR #2217 adds testing for wasm32-wasip1.
PR #2220 adds testing for wasm32-wasip2.