Error cargo build --target wasm32-unknown-unknown

Hi,
I have a simple library referencing tfhe as follows
tfhe = { version = “0.10.0”, features = [“boolean”, “shortint”, “integer”, “aarch64-unix”] }
I am trying to build to a wasm target but getting this error

error: failed to run custom build command for concrete-csprng v0.4.1

Caused by:
process didn’t exit successfully: ~/test-tfhe-rs/target/release/build/concrete-csprng-71a68a103ebfedcb/build-script-build (exit status: 101)
— stderr
thread ‘main’ panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/concrete-csprng-0.4.1/build.rs:45:17:
Feature seeder_unix requires target_family unix, current cfgs: wasm

Is it possible to build to a wasm target?

Hello !

feature aarch64-unix is used for building ARM64 targets, you should remove this if you are building a wasm application.

1 Like

You can use cargo’s [target.'cfg(...)'] to automatically enable or disable tfhe-rs features depending on the target

https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies

2 Likes

thanks. that worked.

1 Like

thanks for the tip. i got it to work.