Stream: beginners

Topic: Running web repl


view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:23):

I'm having trouble running the web repl. Here's the output I'm getting from repl_www/build.sh

+ [[ ! -d repl_www ]]
+ which wasm-pack
/home/degustaf/.cargo/bin/wasm-pack
+ WWW_ROOT=repl_www/build
+ mkdir -p repl_www/build
+ cp -r repl_www/public/repl repl_www/public/repl.css repl_www/public/repl.js repl_www/public/wasi.js repl_www/build
+ '[' -n '' ']'
+ wasm-pack build --target web repl_wasm
[INFO]: Checking for the Wasm target...
Error: wasm32-unknown-unknown target not found in sysroot: "/nix/store/hjjh1mnip37gahmn1w8w2z76lhmvi3aw-rustc-1.58.1"

Used rustc from the following path: "/nix/store/hjjh1mnip37gahmn1w8w2z76lhmvi3aw-rustc-1.58.1/bin/rustc"
It looks like Rustup is not being used. For non-Rustup setups, the wasm32-unknown-unknown target needs to be installed manually. See https://rustwasm.github.io/wasm-pack/book/prerequisites/non-rustup-setups.html on how to do this.

view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:24):

How are other people doing this? Are you using rustup?

view this post on Zulip Brian Carroll (Mar 06 2022 at 17:47):

I probably work on this the most. I do have rustup installed yes.

view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:47):

Then should we be adding it to shell.nix?

view this post on Zulip Brian Carroll (Mar 06 2022 at 17:47):

And I assume that's how I got the wasm32 target! I would remember if I did some special manual thing.

view this post on Zulip Brian Carroll (Mar 06 2022 at 17:48):

I have no idea, I'm not using nix

view this post on Zulip Brendan Hansknecht (Mar 06 2022 at 17:50):

Ah, nix doesn't use rust up and instead directly install rustc and cargo and such

view this post on Zulip Brendan Hansknecht (Mar 06 2022 at 17:50):

Maybe we should switch nix to use rustup. I know it is supported by nix.

view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:51):

I added rustup to nix locally, and got a different error.

+ [[ ! -d repl_www ]]
+ which wasm-pack
/home/degustaf/.cargo/bin/wasm-pack
+ WWW_ROOT=repl_www/build
+ mkdir -p repl_www/build
+ cp -r repl_www/public/repl repl_www/public/repl.css repl_www/public/repl.js repl_www/public/wasi.js repl_www/build
+ '[' -n '' ']'
+ wasm-pack build --target web repl_wasm
Error: Error during execution of `cargo metadata`: error: no override and no default toolchain set

view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:52):

Could this be because the rest of the toolchain is installed directly?

view this post on Zulip Folkert de Vries (Mar 06 2022 at 17:53):

probably

view this post on Zulip Folkert de Vries (Mar 06 2022 at 17:53):

your "other" cargo might not know about the toolchain that rustup specified

view this post on Zulip Brendan Hansknecht (Mar 06 2022 at 17:57):

Yeah, nix cargo doesn't know of rustup. It is separate

view this post on Zulip Derek Gustafson (Mar 06 2022 at 17:58):

okay, I'm cleaning out my nix store, and trying again using rustup in shell.nix instead of the individual rust tools

view this post on Zulip Derek Gustafson (Mar 06 2022 at 18:29):

Cleaning out my nix store probably wasn't the right answer, but it eventually worked.

view this post on Zulip Derek Gustafson (Mar 06 2022 at 18:33):

I think the right answer would be having nix install rustup. Then add a step under nix in BUILDING_FROM_SOURCE telling people to install the toolchains using rustup and setting them as the default.

view this post on Zulip Brendan Hansknecht (Mar 06 2022 at 19:03):

We should probably add a rust-toolchain.toml file to the project instead of having people set the default manually. That can also be used by everyone else to keep rust version consistent

view this post on Zulip Derek Gustafson (Mar 06 2022 at 19:51):

I wasn't aware that was an option. Sounds like a good idea to me

view this post on Zulip Anton (Mar 07 2022 at 10:36):

I have set up a PR with the rust-toolchain file. I'll look into using rustup when I do the nix flake setup.

view this post on Zulip Derek Gustafson (Mar 07 2022 at 11:34):

Sorry, probably should have said something here. I already did this.
https://github.com/rtfeldman/roc/pull/2667

view this post on Zulip Anton (Mar 07 2022 at 12:12):

No problem :+1:


Last updated: Jul 06 2025 at 12:14 UTC