Skip to content

WASI build not working #87

@trinami

Description

@trinami

Hi there,

I tried to build with wasi as described here https://github.com/rustpq/pqcrypto/blob/main/WASM.md It does not seem to work.

❯ cargo build --no-default-features --target wasm32-wasi --features avx2,serialization
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names --target wasm32-wasi --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "wasm32-wasi". Run `rustc --print target-list` for a list of built-in targets

❯ cargo build --no-default-features --target wasm32-wasip1 --features avx2,serialization
    Updating crates.io index
     Locking 28 packages to latest compatible versions
      Adding rand v0.8.5 (available: v0.9.1)
  Downloaded serde-big-array v0.5.1
  Downloaded 1 crate (6.6 KB) in 0.21s
   Compiling libc v0.2.172
   Compiling shlex v1.3.0
   Compiling glob v0.3.2
   Compiling dunce v1.0.5
   Compiling proc-macro2 v1.0.95
   Compiling unicode-ident v1.0.18
   Compiling serde v1.0.219
   Compiling getrandom v0.3.2
   Compiling cfg-if v1.0.0
   Compiling pqcrypto-traits v0.3.5 (/home/user/git/pqcrypto/pqcrypto-traits)
   Compiling paste v1.0.15
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-wasip1` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasip1`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `pqcrypto-traits` (lib) due to 1 previous error
❯ rustup target add wasm32-wasip1
info: downloading component 'rust-std' for 'wasm32-wasip1'
info: installing component 'rust-std' for 'wasm32-wasip1'
 20.6 MiB /  20.6 MiB (100 %)  16.4 MiB/s in  1s         
❯ cargo build --no-default-features --target wasm32-wasip1 --features avx2,serialization
   Compiling libc v0.2.172
   Compiling cfg-if v1.0.0
   Compiling pqcrypto-traits v0.3.5 (/home/user/git/pqcrypto/pqcrypto-traits)
   Compiling proc-macro2 v1.0.95
   Compiling getrandom v0.3.2
   Compiling serde v1.0.219
   Compiling paste v1.0.15
   Compiling quote v1.0.40
   Compiling syn v2.0.101
   Compiling jobserver v0.1.33
   Compiling cc v1.2.21
   Compiling pqcrypto-internals v0.2.11 (/home/user/git/pqcrypto/pqcrypto-internals)
   Compiling pqcrypto-hqc v0.2.1 (/home/user/git/pqcrypto/pqcrypto-hqc)
   Compiling pqcrypto-mldsa v0.1.1 (/home/user/git/pqcrypto/pqcrypto-mldsa)
   Compiling pqcrypto-sphincsplus v0.7.1 (/home/user/git/pqcrypto/pqcrypto-sphincsplus)
   Compiling pqcrypto-classicmceliece v0.2.0 (/home/user/git/pqcrypto/pqcrypto-classicmceliece)
   Compiling pqcrypto-falcon v0.4.0 (/home/user/git/pqcrypto/pqcrypto-falcon)
   Compiling pqcrypto-mlkem v0.1.0 (/home/user/git/pqcrypto/pqcrypto-mlkem)
   Compiling serde_derive v1.0.219
warning: pqcrypto-mlkem@0.1.0: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mlkem-6bbc0f2af89cc512/out/libml-kem-512_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-mlkem v0.1.0 (/home/user/git/pqcrypto/pqcrypto-mlkem)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-mlkem-1842ef887430e43e/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mlkem-6bbc0f2af89cc512/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mlkem-6bbc0f2af89cc512/out/libml-kem-512_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mlkem-6bbc0f2af89cc512/out/libml-kem-512_clean.a"


warning: build failed, waiting for other jobs to finish...
warning: pqcrypto-sphincsplus@0.7.1: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-sphincsplus-8b1498dde8b09d5c/out/libsphincs-shake-128f-simple_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-sphincsplus v0.7.1 (/home/user/git/pqcrypto/pqcrypto-sphincsplus)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-sphincsplus-936dc9184e6b9af3/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-sphincsplus-8b1498dde8b09d5c/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-sphincsplus-8b1498dde8b09d5c/out/libsphincs-shake-128f-simple_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-sphincsplus-8b1498dde8b09d5c/out/libsphincs-shake-128f-simple_clean.a"


warning: pqcrypto-falcon@0.4.0: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-falcon-f817533ee5324edb/out/libfalcon-512_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-falcon v0.4.0 (/home/user/git/pqcrypto/pqcrypto-falcon)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-falcon-fa03968d5d154299/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-falcon-f817533ee5324edb/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-falcon-f817533ee5324edb/out/libfalcon-512_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-falcon-f817533ee5324edb/out/libfalcon-512_clean.a"


warning: pqcrypto-hqc@0.2.1: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-hqc-0b6271546421ab11/out/libhqc-128_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-hqc v0.2.1 (/home/user/git/pqcrypto/pqcrypto-hqc)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-hqc-c81da58728f7dbd1/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-hqc-0b6271546421ab11/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-hqc-0b6271546421ab11/out/libhqc-128_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-hqc-0b6271546421ab11/out/libhqc-128_clean.a"


warning: pqcrypto-mldsa@0.1.1: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mldsa-876fbd8ec40e79d2/out/libml-dsa-44_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-mldsa v0.1.1 (/home/user/git/pqcrypto/pqcrypto-mldsa)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-mldsa-9466a05db015db27/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mldsa-876fbd8ec40e79d2/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mldsa-876fbd8ec40e79d2/out/libml-dsa-44_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-mldsa-876fbd8ec40e79d2/out/libml-dsa-44_clean.a"


warning: pqcrypto-classicmceliece@0.2.0: /usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-classicmceliece-da5214a64b4eb868/out/libmceliece348864_clean.a': No such file or directory
error: failed to run custom build command for `pqcrypto-classicmceliece v0.2.0 (/home/user/git/pqcrypto/pqcrypto-classicmceliece)`

Caused by:
  process didn't exit successfully: `/home/user/git/pqcrypto/target/debug/build/pqcrypto-classicmceliece-1d2512cabce7ad72/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-classicmceliece-da5214a64b4eb868/out)
  TARGET = Some(wasm32-wasip1)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_wasm32-wasip1
  AR_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=AR_wasm32_wasip1
  AR_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=CC_wasm32-wasip1
  CC_wasm32-wasip1 = None
  cargo:rerun-if-env-changed=CC_wasm32_wasip1
  CC_wasm32_wasip1 = 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=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32_wasip1
  ARFLAGS_wasm32_wasip1 = None
  cargo:rerun-if-env-changed=ARFLAGS_wasm32-wasip1
  ARFLAGS_wasm32-wasip1 = None
  cargo:warning=/usr/bin/llvm-ar: error: unable to load '/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-classicmceliece-da5214a64b4eb868/out/libmceliece348864_clean.a': No such file or directory

  --- stderr


  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): "/usr/bin/llvm-ar" "s" "/home/user/git/pqcrypto/target/wasm32-wasip1/debug/build/pqcrypto-classicmceliece-da5214a64b4eb868/out/libmceliece348864_clean.a"

What am I doing wrong? Or is it broke? Thank you very much

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions