Skip to content

Instantly share code, notes, and snippets.

@frehberg
Created September 8, 2018 14:41
Show Gist options
  • Save frehberg/01e67ef9164eefec16e6915810c2a81e to your computer and use it in GitHub Desktop.
Save frehberg/01e67ef9164eefec16e6915810c2a81e to your computer and use it in GitHub Desktop.
Rust wasm-pack on Ubuntu-18.04
# Rust wasm-pack on Ubuntu-18.04
If you follow the rust-wasm-book https://rustwasm.github.io/book/introduction.html you will run into problems executing the step `wasm-pack init`
on UBuntu-18.04 as the latest version of tool wasm-pack requires LLVM-7.
LLVM-7 is not shipped with Ubuntu-18.04 so far, it must be installed from third-party repository. For details see http://apt.llvm.org/
## LLVM-7 installaton steps
Add the following debian-repos of your package manager, for example using the tool `synaptic`
```
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
```
Add the corresponding package-signer key to your trusted keypool.
```
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
```
Now update the repository list and install the LLVM-7 and dev-packages
```
sudo apt-get update
sudo apt-get install clang-7 lldb-7 lld-7 libllvm7 llvm-7 llvm-7-dev
```
Perform an update of Rust-nightly/stable
```
rustup update
```
Now enter your Rust/wasm-project, perform a clean-up and re-compile.
```
cargo clean
wasm-pack init
```
Now you should find the compiled package in subfolder ./pkg/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment