Skip to content

Instantly share code, notes, and snippets.

@derhuerst
Last active June 6, 2021 18:02
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save derhuerst/830c0361a17133ff5702b357a43eb4d9 to your computer and use it in GitHub Desktop.
Save derhuerst/830c0361a17133ff5702b357a43eb4d9 to your computer and use it in GitHub Desktop.
Rust WASM setup on macOS (with fish shell)

warning: took more than an hour on my machine, because it had to compile fastcomp

  • xcode-select --install
  • make sure, python in your $PATH is Python 2, not 3
  • brew install cmake
  • follow "install Rust" and "install Emscripten" from https://davidmcneil.gitbooks.io/the-rusty-web/setup-and-hello-world.html
    • curl https://sh.rustup.rs -sSf | sh
    • add $HOME/.cargo/env to your $PATH (set -U fish_user_paths …)
    • rustup install nightly
    • rustup default nightly
    • rustup target add asmjs-unknown-emscripten
    • rustup target add wasm32-unknown-emscripten
    • bash
      • source ./emsdk-portable/emsdk_env.sh
      • emsdk update
      • emsdk install sdk-incoming-64bit
      • emsdk activate sdk-incoming-64bit
      • source ./emsdk-portable/emsdk_env.sh
      • emcc --version – should work
  • bash
    • source ./emsdk-portable/emsdk_env.sh
    • rustc --target=asmjs-unknown-emscripten lib/main.rs -o demo.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment