Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating WASM for the browser #2366

Open
cobite opened this issue Oct 30, 2024 · 1 comment
Open

Generating WASM for the browser #2366

cobite opened this issue Oct 30, 2024 · 1 comment

Comments

@cobite
Copy link
Contributor

cobite commented Oct 30, 2024

I'm creating a browser extension and would like to use wasm for the client api.

I'm following along with the instructions on:
https://github.com/maidsafe/safe_network/tree/main/autonomi

I got the latest maidsafe repo code, then I cd into the autonomi folder.

Then I do:

cargo build

After that I cd back to the root and run:

SAFE_PEERS=/ip4/157.245.40.245/udp/57224/quic-v1/p2p/12D3KooWGB1aq5dbWT8oY5hQwmT63JZSgtLDMRWhnNuoM7fvpdGf wasm-pack test --release --firefox autonomi --features=data,files --test wasm -- put

The error I get:

[INFO]: 🎯  Checking for the Wasm target...
error: none of the selected packages contains these features: files, did you mean: fs, full?
Error: Compilation of your program failed
Caused by: Compilation of your program failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "autonomi" && "cargo" "build" "--tests" "--release" "--target" "wasm32-unknown-unknown" "--features=data,files" "--test" "wasm"
@cobite
Copy link
Contributor Author

cobite commented Nov 12, 2024

I changed --features=data,files to --features=data

Now I seem to get further in the build process, but I now get the following:

The following warnings were emitted during compilation:


warning: [email protected]: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: [email protected]: 1 error generated.

error: failed to run custom build command for `blst v0.3.13`


Caused by:
  process didn't exit successfully: `/safe_network/target/release/build/blst-829a41e45397a7fd/build-script-build` (exit status: 1)


    error occurred: Command "clang" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-fno-exceptions" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-ffreestanding" "-D__BLST_NO_ASM__" "-D__BLST_PORTABLE__" "-DSCRATCH_LIMIT=(45 * 1024)" "-o" "/safe_network/target/wasm32-unknown-unknown/release/build/blst-a76cd73b679018c0/out/76cbfa861e1aafe5-server.o" "-c" "/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blst-0.3.13/blst/src/server.c" with args clang did not execute successfully (status code exit status: 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant