From 83d8b11915975d1571022d90c6b14f355948a548 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Mon, 24 Feb 2025 10:10:29 +0100 Subject: [PATCH 1/2] chore: Update build docs --- docs/BUILD.md | 70 +++++++++++++++++++++++++++++-------- lib/compiler-llvm/README.md | 6 ++-- 2 files changed, 59 insertions(+), 17 deletions(-) diff --git a/docs/BUILD.md b/docs/BUILD.md index 3c95cb20a72..45fd52c5287 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -2,7 +2,7 @@ ## Installing Rustup -Building Wasmer from source requires [Rust](https://rustup.rs/) **1.67+**. +Building Wasmer from source requires [Rust](https://rustup.rs/) **1.81+**. The easiest way to install Rust on your system is via Rustup. To get Rustup on Linux and macOS, you can run the following: @@ -15,14 +15,31 @@ curl https://sh.rustup.rs -sSf | sh ## Installing Additional Dependencies +### Linux +Linux is fully supported by Wasmer. WASI(x) is also fully supported. Users +building from source can enable the LLVM backend following the instruction in +the dedicated section below and installing LLVM version 18. To install it, +refer to [LLVM's download +page](https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.7) or +check your distro's package manager. + + +### macOS +macOS is fully supported by Wasmer. WASI(x) is also fully supported. Users +building from source can enable the LLVM backend following the instruction in +the dedicated section below and installing LLVM version 18. To install it on +macOS, you can use [homebrew](https://brew.sh/): `brew install llvm@18`. + + ### Windows -Windows is fully supported by Wasmer. WASI is also fully supported. +Windows is fully supported by Wasmer. WASI(x) is also fully supported. 1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) 2. Install [Rust for Windows](https://win.rustup.rs/) 3. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default settings for the installer are fine). -4. \(optional\) Install [LLVM 11.0](https://prereleases.llvm.org/win-snapshots/LLVM-11.0.0-2663a25f-win64.exe) +4. \(optional\) Install [LLVM 18.0](https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.7/LLVM-18.1.7-win64.exe) + ## Building the Wasmer Runtime @@ -35,41 +52,53 @@ git clone https://github.com/wasmerio/wasmer.git cd wasmer ``` -Wasmer supports three different compilers at the moment: +Wasmer supports six different backends at the moment: `singlepass`, +`cranelift`, `LLVM`, `V8`, `wasmi` and `wamr`. ### Singlepass Compiler -Build Wasmer: +The Singlepass compiler works on Linux, Darwin and Windows systems on amd64 +platforms and on Linux and Darwin systems on aarch64 platforms. Currently, it +doesn't work on `RISC-V` or `loongarch64`. On system in which it can be used it +is enabled by default. + +You can build Wasmer by running this command in the root of the repo: ```text make build-wasmer ``` -**Note**: you should see this `Enabled Compilers: singlepass` in console. +**Note**: you should see `singlepass` appear in the `Enabled Compilers: ...` message in the console. -You may disable Singlepass compiler with `export ENABLE_SINGLEPASS=0`. +You may disable the Singlepass backend with the `ENABLE_SINGLEPASS=0` environment +variable, and force its enabling with `ENABLE_SINGLEPASS=1`. ### Cranelift Compiler -The Cranelift compiler will work if you are on a X86 or ARM machine. It will be detected automatically, so you don't need to do anything to your system to enable it. +The Cranelift compiler will work if you are on a X86 or ARM machine. On system +in which it can be used it is enabled by default. + +You can build Wasmer by running this command in the root of the repo: ```text make build-wasmer ``` -**Note**: should see this as the first line in the console: -`Enabled Compilers: cranelift` +**Note**: you should see `cranelift` appear in the `Enabled Compilers: ...` message in the console. -You may disable the Cranelift compiler with `export ENABLE_CRANELIFT=0`. +You may disable the Cranelift backend with the `ENABLE_SINGLEPASS=0` environment +variable, and force its enabling with `ENABLE_SINGLEPASS=1`. ### LLVM Compiler -If you want support for the Wasmer LLVM compiler, then you will also need to ensure: +If you want support for the Wasmer LLVM compiler, then you will also need to: -* Ensure that LLVM 10.0.x > is installed on your system +* Ensure that LLVM >=18.0.x is installed on your system * You can refer to [LLVM install instructions](https://github.com/wasmerio/wasmer/tree/master/lib/compiler-llvm#requirements) * You can also [download and use a prebuilt LLVM binary](https://releases.llvm.org/download.html) -* In case `llvm-config` is not accessible, set the correct environment variable for LLVM to access: For example, the environment variable for LLVM 11.0.x would be: `LLVM_SYS_110_PREFIX=/path/to/unpacked/llvm-11.0` +* In case `llvm-config` is not accessible, set the correct environment variable + for LLVM to access: For example, the environment variable for LLVM 18.0.x + would be: `LLVM_SYS_180_PREFIX=/path/to/unpacked/llvm-18.0` And create a Wasmer release @@ -82,6 +111,19 @@ make build-wasmer You may disable the LLVM compiler with `export ENABLE_LLVM=0`. +### V8, wasmi and wamr +To enable any of these backends, you can set the according `ENABLE_=1` +flag at build time. The build script itself will download the necessary +libraries at build time. + +Note, however, that these backends are not supported on all the platforms that +Wasmer can run on. + +For example, to have a Wasmer build with all three backends enabled you can run: +```text +ENABLE_V8=1 ENABLE_WASMI=1 ENABLE_WAMR=1 make build-wasmer +``` + ### All compilers Once you have LLVM and Rust, you can just run: diff --git a/lib/compiler-llvm/README.md b/lib/compiler-llvm/README.md index e5d74287597..360899d3da4 100644 --- a/lib/compiler-llvm/README.md +++ b/lib/compiler-llvm/README.md @@ -23,20 +23,20 @@ to native speeds. ## Requirements The LLVM compiler requires a valid installation of LLVM in your system. -It currently requires **LLVM 15**. +It currently requires **LLVM 18**. You can install LLVM easily on your Debian-like system via this command: ```bash wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh -sudo bash /tmp/llvm.sh 15 +sudo bash /tmp/llvm.sh 18 ``` Or in macOS: ```bash -brew install llvm@15 +brew install llvm@18 ``` Or via any of the [pre-built binaries that LLVM offers][llvm-pre-built]. From b1e1974de6cde61c88ccae89edd78c965b0b2147 Mon Sep 17 00:00:00 2001 From: Edoardo Marangoni Date: Mon, 24 Feb 2025 17:45:06 +0100 Subject: [PATCH 2/2] Update "Build Status" in READMEs --- docs/cn/README.md | 2 +- docs/de/README.md | 2 +- docs/es/README.md | 2 +- docs/ko/README.md | 2 +- lib/api/README.md | 2 +- lib/c-api/README.md | 2 +- lib/cli-compiler/README.md | 3 ++- lib/cli/README.md | 2 +- lib/compiler-cranelift/README.md | 2 +- lib/compiler-llvm/README.md | 2 +- lib/compiler-singlepass/README.md | 3 ++- lib/compiler/README.md | 2 +- lib/vm/README.md | 2 +- lib/wasix/README.md | 2 +- 14 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/cn/README.md b/docs/cn/README.md index a958dc95fd7..6bbb500bf29 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -5,7 +5,7 @@

- Build Status + Build Status License diff --git a/docs/de/README.md b/docs/de/README.md index 20da4b5920b..8edd37cb0b5 100644 --- a/docs/de/README.md +++ b/docs/de/README.md @@ -5,7 +5,7 @@

- Build Status + Build Status Lizenz diff --git a/docs/es/README.md b/docs/es/README.md index 360a4be06de..69a57c97cb0 100644 --- a/docs/es/README.md +++ b/docs/es/README.md @@ -5,7 +5,7 @@

- Build Status + Build Status License diff --git a/docs/ko/README.md b/docs/ko/README.md index 3fda75001b3..984dc4d5bc0 100644 --- a/docs/ko/README.md +++ b/docs/ko/README.md @@ -5,7 +5,7 @@

- Build Status + Build Status License diff --git a/lib/api/README.md b/lib/api/README.md index 843cfd32381..2de372f5c0c 100644 --- a/lib/api/README.md +++ b/lib/api/README.md @@ -1,4 +1,4 @@ -# `wasmer` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer.svg)](https://crates.io/crates/wasmer) +# `wasmer` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer.svg)](https://crates.io/crates/wasmer) [`Wasmer`](https://wasmer.io/) is the most popular [WebAssembly](https://webassembly.org/) runtime for Rust. It supports JIT (Just diff --git a/lib/c-api/README.md b/lib/c-api/README.md index 7a8afabf555..e4136492f6f 100644 --- a/lib/c-api/README.md +++ b/lib/c-api/README.md @@ -1,4 +1,4 @@ -# `wasmer-c-api` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) +# `wasmer-c-api` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) This crate exposes a C and a C++ API for the Wasmer runtime. It also fully supports the [wasm-c-api common API](https://github.com/WebAssembly/wasm-c-api). diff --git a/lib/cli-compiler/README.md b/lib/cli-compiler/README.md index e4d435c447a..a4cba6cee90 100644 --- a/lib/cli-compiler/README.md +++ b/lib/cli-compiler/README.md @@ -1,4 +1,5 @@ -# `wasmer-cli-compiler` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) +# `wasmer-cli-compiler` +[![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) This crate is the Wasmer Compiler only CLI. diff --git a/lib/cli/README.md b/lib/cli/README.md index cbac87b1da7..c7a28dca36b 100644 --- a/lib/cli/README.md +++ b/lib/cli/README.md @@ -1,4 +1,4 @@ -# `wasmer-cli` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) +# `wasmer-cli` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) This crate is the Wasmer CLI. diff --git a/lib/compiler-cranelift/README.md b/lib/compiler-cranelift/README.md index 760cdf54b13..6dbb86a56fb 100644 --- a/lib/compiler-cranelift/README.md +++ b/lib/compiler-cranelift/README.md @@ -1,4 +1,4 @@ -# `wasmer-compiler-cranelift` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-cranelift.svg)](https://crates.io/crates/wasmer-compiler-cranelift) +# `wasmer-compiler-cranelift` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-cranelift.svg)](https://crates.io/crates/wasmer-compiler-cranelift) This crate contains a compiler implementation based on Cranelift. diff --git a/lib/compiler-llvm/README.md b/lib/compiler-llvm/README.md index 360899d3da4..e2d789068c3 100644 --- a/lib/compiler-llvm/README.md +++ b/lib/compiler-llvm/README.md @@ -1,4 +1,4 @@ -# `wasmer-compiler-llvm` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-llvm.svg)](https://crates.io/crates/wasmer-compiler-llvm) +# `wasmer-compiler-llvm` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-llvm.svg)](https://crates.io/crates/wasmer-compiler-llvm) This crate contains a compiler implementation based on [the LLVM Compiler Infrastructure][LLVM]. diff --git a/lib/compiler-singlepass/README.md b/lib/compiler-singlepass/README.md index 6bbf623546c..48a0d6dde08 100644 --- a/lib/compiler-singlepass/README.md +++ b/lib/compiler-singlepass/README.md @@ -1,4 +1,5 @@ -# `wasmer-compiler-singlepass` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-singlepass.svg)](https://crates.io/crates/wasmer-compiler-singlepass) +# `wasmer-compiler-singlepass` +[![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-compiler-singlepass.svg)](https://crates.io/crates/wasmer-compiler-singlepass) This crate contains a compiler implementation based on the Singlepass linear compiler. diff --git a/lib/compiler/README.md b/lib/compiler/README.md index d15b26695f8..a6bbf5953ba 100644 --- a/lib/compiler/README.md +++ b/lib/compiler/README.md @@ -1,4 +1,4 @@ -# `wasmer-compiler` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) +# `wasmer-compiler` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) This crate is the base for Compiler implementations. diff --git a/lib/vm/README.md b/lib/vm/README.md index 7854b0eae23..1d628b17e14 100644 --- a/lib/vm/README.md +++ b/lib/vm/README.md @@ -1,4 +1,4 @@ -# `wasmer-vm` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) +# `wasmer-vm` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) This crate contains the Wasmer VM runtime library, supporting the Wasm ABI used by wasmer. diff --git a/lib/wasix/README.md b/lib/wasix/README.md index 482122152ea..a26e86eaa8c 100644 --- a/lib/wasix/README.md +++ b/lib/wasix/README.md @@ -1,4 +1,4 @@ -# `wasmer-wasi` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-wasi.svg)](https://crates.io/crates/wasmer-wasi) +# `wasmer-wasi` [![Build Status](https://github.com/wasmerio/wasmer/actions/workflows/build.yml/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/main/LICENSE) [![crates.io](https://img.shields.io/crates/v/wasmer-wasi.svg)](https://crates.io/crates/wasmer-wasi) This crate provides the necessary imports to use WASI easily from Wasmer. [WebAssembly System Interface](https://github.com/WebAssembly/WASI)