Skip to content

Refactor docs for how to install wit-bindgen and wasm-tools #133

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

Open
wants to merge 1 commit into
base: js-ts-docs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"app-manifest": "Application Manifest",
"function-names": "Function names",
"golem-host-functions": "Golem Host Functions",
"installing-webassembly-tooling": "Installing WebAssembly Tooling",
"json-wave-mapping": "JSON-WAVE Mapping",
"rest-api": "REST API",
"rib": "Rib",
Expand Down
58 changes: 2 additions & 56 deletions src/pages/ccpp-language-guide/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,8 @@ To write **Golem components** in C or C++, a couple of common WebAssembly tools

## Install WebAssembly tooling

First of all, to install `wasm-tools` via `cargo`, you need to install the latest stable version of Rust. The recommended way to do so is using [https://rustup.rs](https://rustup.rs/):

<Steps>

### Install Rust

Install rustup

```shell copy
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Install the latest stable version of Rust

```shell copy
rustup install stable && rustup default stable
```

Add the WASI target

```shell copy
rustup target add wasm32-wasip1
```

### Install `wasm-tools`

```shell copy
cargo install --force --locked wasm-tools@1.223.0
```

Confirm the installation:

```shell
wasm-tools --version
wasm-tools 1.223.0
```

### Install `wit-bindgen`

```shell copy
cargo install --force --locked wit-bindgen-cli@0.37.0
```

Confirm the installation:

```shell
wit-bindgen --version
wit-bindgen-cli 0.37.0
```

</Steps>

<Callout type="warning">
Golem requires a **specific version** of `wasm-tools` and `wit-bindgen`. Please make sure the
correct version is installed with the commands described above.
</Callout>
You will need both `wasm-tools` and `wit-bindgen` to work on C/C++ WebAssembly projects.
Consult the [dedicated page](/installing-webassembly-tooling) for instructions on how to install them.

## Install WASI SDK 25.0

Expand Down
59 changes: 3 additions & 56 deletions src/pages/go-language-guide/setup.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Callout } from "nextra/components"
import { Steps } from "nextra/components"
import { MultiPlatformCommand } from "@/components/multi-platform-command"

# Setup Go

Expand All @@ -26,59 +27,5 @@ brew install tinygo

## Install WebAssembly tooling

First of all, to install `wasm-tools` via `cargo`, you need to install the latest stable version of Rust. The recommended way to do so is using [https://rustup.rs](https://rustup.rs/):

<Steps>

### Install Rust

Install rustup

```bash copy
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Install the latest stable version of Rust

```bash copy
rustup install stable && rustup default stable
```

Add the WASI target

```bash copy
rustup target add wasm32-wasip1
```

### Install `wasm-tools`

```bash copy
cargo install --force --locked wasm-tools@1.223.0
```

Confirm the installation:

```bash
wasm-tools --version
wasm-tools 1.223.0
```

### Install `wit-bindgen`

```bash copy
cargo install --force --locked wit-bindgen-cli@0.37.0
```

Confirm the installation:

```bash
wit-bindgen --version
wit-bindgen-cli 0.37.0
```

</Steps>

<Callout type="warning">
Golem requires a **specific version** of `wasm-tools` and `wit-bindgen`. Please make sure the
correct version is installed with the commands described above.
</Callout>
You will need both `wasm-tools` and `wit-bindgen` to work on Go WebAssembly projects.
Consult the [dedicated page](/installing-webassembly-tooling) for instructions on how to install them.
122 changes: 122 additions & 0 deletions src/pages/installing-webassembly-tooling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { Callout } from "nextra/components"
import { Steps } from "nextra/components"
import { MultiPlatformCommand } from "@/components/multi-platform-command"
import { Tabs } from "nextra/components"

# Installing WebAssembly tooling

<Callout type="warning">
Golem only supports **specific versions** of `wasm-tools` and `wit-bindgen`. Please make sure to
follow the guides carefully and install the correct versions.
</Callout>

You will need both `wasm-tools` and `wit-bindgen` to work with WebAssembly in a lot of languages.
You can either download these from GitHub or build from source using cargo.

<Tabs items={["Download (Linux)", "Download (Windows)", "Using cargo"]}>
<Tabs.Tab>
{/* Download (Linux) */}
<Steps>
### wit-bindgen
Download the correct asset for your system from the [GitHub Release](https://github.com/bytecodealliance/wit-bindgen/releases/tag/v0.37.0).

Extract the downloaded archive:
```bash copy
❯ tar xvf wit-bindgen-0.37.0-x86_64-linux.tar.gz
x wit-bindgen-0.37.0-x86_64-linux/
x wit-bindgen-0.37.0-x86_64-linux/README.md
x wit-bindgen-0.37.0-x86_64-linux/LICENSE-APACHE
x wit-bindgen-0.37.0-x86_64-linux/wit-bindgen
x wit-bindgen-0.37.0-x86_64-linux/LICENSE-MIT
x wit-bindgen-0.37.0-x86_64-linux/LICENSE-Apache-2.0_WITH_LLVM-exception
```

Install to /usr/local/bin:
```bash copy
❯ sudo install -D -t /usr/local/bin wit-bindgen-0.37.0-x86_64-linux/wit-bindgen
```

### wasm-tools
Download the correct asset for your system from the [GitHub Release](https://github.com/bytecodealliance/wasm-tools/releases/tag/v1.223.0).

Extract the downloaded archive:
```bash copy
❯ tar xvf wasm-tools-1.223.0-x86_64-linux.tar.gz
x wasm-tools-1.223.0-x86_64-linux/
x wasm-tools-1.223.0-x86_64-linux/README.md
x wasm-tools-1.223.0-x86_64-linux/wasm-tools
x wasm-tools-1.223.0-x86_64-linux/LICENSE-APACHE
x wasm-tools-1.223.0-x86_64-linux/LICENSE-MIT
x wasm-tools-1.223.0-x86_64-linux/LICENSE-Apache-2.0_WITH_LLVM-exception
```

Install to /usr/local/bin:
```bash copy
❯ sudo install -D -t wasm-tools-1.223.0-x86_64-linux/wasm-tools
```
</Steps>
</Tabs.Tab>
<Tabs.Tab>
{/* Download (Windows) */}
Download the [wit-bindgen](https://github.com/bytecodealliance/wit-bindgen/releases/tag/v0.37.0) and
[wasm-tools](https://github.com/bytecodealliance/wasm-tools/releases/tag/v1.223) Windows archives.

Extract the archives and place the `wit-bindgen` and `wasm-tools` binaries into a folder.

Add the folder to the PATH environment variable.
</Tabs.Tab>
<Tabs.Tab>
{/* Build from source */}
First of all, to install `wasm-tools` via `cargo`, you need to install the latest stable version of Rust. The recommended way to do so is using [https://rustup.rs](https://rustup.rs/):

<Steps>

### Install Rust

Install rustup

```bash copy
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Install the latest stable version of Rust

```bash copy
rustup install stable && rustup default stable
```

Add the WASI target

```bash copy
rustup target add wasm32-wasip1
```

### Install `wasm-tools`

```bash copy
cargo install --force --locked wasm-tools@1.223.0
```

Confirm the installation:

```bash
wasm-tools --version
wasm-tools 1.223.0
```

### Install `wit-bindgen`

```bash copy
cargo install --force --locked wit-bindgen-cli@0.37.0
```

Confirm the installation:

```bash
wit-bindgen --version
wit-bindgen-cli 0.37.0
```

</Steps>
</Tabs.Tab>
</Tabs>