diff --git a/source/_posts/2020/Q1/2020-02-16-linux-distribution-kernel-glibc-version.md b/source/_posts/2020/Q1/2020-02-16-linux-distribution-kernel-glibc-version.md index c069a397..ff290c9e 100644 --- a/source/_posts/2020/Q1/2020-02-16-linux-distribution-kernel-glibc-version.md +++ b/source/_posts/2020/Q1/2020-02-16-linux-distribution-kernel-glibc-version.md @@ -35,34 +35,38 @@ Ubuntu 12.04 | 2012-04 | 2.15 | 4.6.3 | 3. Ubuntu 14.04 | 2014-04 | 2.19 | 4.9.3 | 3.13 SLE 12 | 2014-10 | 2.19 -> 2.22 | 4.8.3 -> 13.2 | [3.12 -> 4.12](https://www.suse.com/lifecycle/) Debian 8 | 2015-04 | 2.19 | 4.9.2 | 3.16 -Ubuntu 16.04 | 2016-04 | 2.23 | 4.9.3 | 4.4 +Ubuntu 16.04 | 2016-04 | 2.23 | 5.4.0 | 4.4 Debian 9 | 2017-06 | 2.24 | 6.3 | 4.9 Amazon Linux 2 LTS | 2018-06 | 2.26 | 7.3 | 4.14 -SLE 15 | 2018-07 | 2.26 -> 2.31 | 7.3 -> 13.2 | [4.12 -> 5.14](https://www.suse.com/lifecycle/) -**Ubuntu 18.04** | 2018-04 | **2.27** | 8.4 | 4.15 -RHEL 8 | 2019-05 | 2.28 | 8.5 | 4.18 +SLE 15 | 2018-07 | 2.26 | 7.3 | [4.12](https://www.suse.com/lifecycle/) +Ubuntu 18.04 | 2018-04 | 2.27 | 8.4 | 4.15 +**RHEL 8** | 2019-05 | **2.28** | 8.5 | 4.18 Debian 10 | 2019-07 | 2.28 | 8.3 | 4.19 openEuler 20.03 | 2020-03 | 2.28 | 7.3 | 4.19 -Ubuntu 20.04 | 2020-04 | 2.31 | 10.3 | 5.4 +Ubuntu 20.04 | 2020-04 | 2.31 | 10.5 | 5.4 +SLE 15 SP3 | 2021-06 | 2.31 | 10.2 | 5.3 **Debian 11** | 2021-08 | **2.31** | 10.2 | 5.10 +SLE 15 SP4 | 2022-06 | 2.31 | 11.2 | [5.14](https://www.suse.com/lifecycle/#suse-linux-enterprise-server-15) openEuler 22.03 | 2022-03 | 2.34 | 10.3 | 5.10 -**RHEL 9** | 2022-05 | **2.34** | 11.4 | 5.14 +RHEL 9 | 2022-05 | 2.34 | 11.4 | 5.14 Amazon Linux 2023 | 2023-03 | 2.34 | 11.4 | 6.1 CBL-Mariner 2.0 | 2022-05 | 2.35 | 11.2 | 5.15 -Ubuntu 22.04 | 2022-04 | 2.35 | 12.1 | 5.15 +Ubuntu 22.04 | 2022-04 | 2.35 | 12.3 | 5.15 Debian 12 | 2023-06 | [2.36](https://tracker.debian.org/pkg/glibc) | [12.2](https://packages.debian.org/bookworm/libgcc-s1) | [6.1](https://tracker.debian.org/pkg/linux) -openEuler 24.04 | 2024-06 | 2.38 | 12.3 | 6.6 +openEuler 24.03 | 2024-06 | 2.38 | 12.3 | 6.6 SLE 15 SP6 | 2024-06 | 2.38 | 13.3 | 6.4 -**Ubuntu 24.04** | 2024-04 | **2.39** | 14.0 | 6.8 +Ubuntu 24.04 | 2024-04 | 2.39 | 14.0 | 6.8 Fedora 40 | 2024-04 | 2.39 | 14.1 | 6.9 +[CentOS Stream 10](https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/os/Packages/) | 2024-08 | 2.39 | 14.2 | 6.11 +Ubuntu 24.10 | 2024-10 | 2.40 | 14.2 | 6.11 Debian 13 | ***2025-06*** | [2.40 ?](https://tracker.debian.org/pkg/glibc) | [14.2 ?](https://packages.debian.org/trixie/libgcc-s1) | [6.12 ?](https://tracker.debian.org/pkg/linux) RHEL 10 | ***2025-08*** | [2.40 ?](https://composes.stream.centos.org/stream-10/production/latest-CentOS-Stream/compose/BaseOS/x86_64/os/Packages/) | [14.2 ?](https://composes.stream.centos.org/stream-10/production/latest-CentOS-Stream/compose/BaseOS/x86_64/os/Packages/) | [6.12 ?](https://composes.stream.centos.org/stream-10/production/latest-CentOS-Stream/compose/BaseOS/x86_64/os/Packages/) -[SUSE Adaptable Linux Platform (ALP)](https://download.opensuse.org/repositories/SUSE:/ALP/) | ***2025-??*** | 2.39 ? | 14.0 ? | 6.8 ? -[**openSUSE Tumbleweed**](https://download.opensuse.org/tumbleweed/repo/oss/x86_64/) | ***Rolling*** | 2.39 ? | 14.1 ? | 6.9 ? +[SUSE Adaptable Linux Platform (ALP)](https://download.opensuse.org/repositories/SUSE:/ALP:/) | ***2025-??*** | 2.40 ? | 14.2 ? | 6.10 ? +[**openSUSE Tumbleweed**](https://download.opensuse.org/tumbleweed/repo/oss/x86_64/) | ***Rolling*** | 2.40 ? | 14.2 ? | 6.10 ? Alpine 3.18 | [2023-05](https://alpinelinux.org/releases/) | musl [1.2.4](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.18-stable/main/musl/APKBUILD) | [libgcc 12.2](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.18-stable/main/gcc/APKBUILD) | [6.1](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.18-stable/main/linux-lts/APKBUILD) Alpine 3.19 | [2023-12](https://alpinelinux.org/releases/) | musl [1.2.4](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.19-stable/main/musl/APKBUILD) | [libgcc 13.2](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.19-stable/main/gcc/APKBUILD) | [6.6](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.19-stable/main/linux-lts/APKBUILD) Alpine 3.20 | [2024-05](https://alpinelinux.org/releases/) | musl [1.2.5](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.20-stable/main/musl/APKBUILD) | [libgcc 13.2](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.20-stable/main/gcc/APKBUILD) | [6.6](https://gitlab.alpinelinux.org/alpine/aports/-/blob/3.20-stable/main/linux-lts/APKBUILD) -Alpine edge | [***2024-11***](https://alpinelinux.org/releases/) | musl [1.2.5](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/musl/APKBUILD) | [libgcc 13.2](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/gcc/APKBUILD) | [6.6](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-lts/APKBUILD) +Alpine edge | [2024-11](https://alpinelinux.org/releases/) | musl [1.2.5](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/musl/APKBUILD) | [libgcc 14.2](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/gcc/APKBUILD) | [6.6](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-lts/APKBUILD) ## libgcc versions diff --git a/source/_posts/2024/Q3/2024-07-27-wasm32-wasip2.md b/source/_posts/2024/Q3/2024-07-27-wasm32-wasip2.md new file mode 100644 index 00000000..7165d146 --- /dev/null +++ b/source/_posts/2024/Q3/2024-07-27-wasm32-wasip2.md @@ -0,0 +1,262 @@ +--- +title: 'Rust project promote the wasm32-wasip2 target to Tier 2' +excerpt: 'Rust project promote the wasm32-wasip2 target to Tier 2' +date: 2024-07-28 13:31:27 +tags: + - Linux + - Rust + - WASM +categories: [Programming] +--- + +# Rust project promote the wasm32-wasip2 target to Tier 2 + +The `wasm32-wasip2` target is an extension to `wasm32-wasip1` target, originally known as `wasm32-wasi`. It is the next evolution in the development of WASI (the WebAssembly System Interface) that uses the WebAssembly component model to allow for a standardized set of syscalls that are intended to empower WebAssembly binaries with native host capabilities. This target is **cross-compiled**. The target supports `std` fully. + +On February 28, 2024, Rust [merged the tier 3 target `wasm32-wasip2`](https://github.com/rust-lang/rust/pull/119616); on July 17, 2024, the [target `wasm32-wasip2` was promoted to tier 2](https://github.com/rust-lang/rust/pull/126967). + +WASI has released two milestone versions, [**0.1**](https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md) and [**0.2**](https://github.com/WebAssembly/WASI/blob/main/preview2/README.md). They correspond to Rust targets [`wasm32-wasip1`](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip1.html) and [`wasm32-wasip2`](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip2.html) respectively. + +WASI Preview 2 represents a major milestone for WASI. It marks the moment when WASI has fully rebased on the **Wit IDL** and the **component model** type system and semantics, making it modular, fully virtualizable, and accessible to a wide variety of source languages. + +WASI Preview 2 is also known as “WASI 0.2”, and corresponds to versions numbered `0.2.x` in Wit packages and related identifiers. It is also known as “WASIp2”, where the “p” stands for either “preview” or “point”. + +WASI Preview 2 contains the following APIs: + +| Proposal | Versions | +| ---------------- | -------- | +| wasi-io | 0.2.0 | +| wasi-clocks | 0.2.0 | +| wasi-random | 0.2.0 | +| wasi-filesystem | 0.2.0 | +| wasi-sockets | 0.2.0 | +| wasi-cli | 0.2.0 | +| wasi-http | 0.2.0 | + +## What You Need + +- ✓ `WASI SDK 23.0` or later +- ✓ `wasmtime 23.0.1` or later +- ⍻ `WasmEdge 0.14.0` or later (wasm32-wasip1 only) +- ⍻ `wasmer 4.3.5` or later (wasm32-wasip1 only) +- ⍻ `wasmi 0.36.0` or later (No binary packages, requires `rust 1.77.0` or newer to compile) (wasm32-wasip1 only) +- ⍻ `wazero 1.7.3` or later (wasm32-wasip1 only) +- ⍻ `WebAssembly Micro Runtime 2.1.1` or later (wasm32-wasip1 only) + +## WASI SDK + +Let's first use the classic **Hello World** program to test the each WASI implementation: + +### hello.c + +```c +#include +int main(void) +{ + fprintf(stdout, "Hello, World!\n"); + return 0; +} +``` + +### wasm32-wasip1 + +Generate WASM files for target `wasm32-wasip1`: + +```bash +# /opt/wasi-sdk-23/bin/clang -v -Wl,--version --target=wasm32-wasip1 + +# /opt/wasi-sdk-23/bin/clang --target=wasm32-wasip1 -o hello-p1.wasm hello.c + +# file hello-p1.wasm +hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) +``` + +All 6 WASI implementations used in this article support the target `wasm32-wasip1`: + +```bash +# wasmtime hello-p1.wasm +Hello, World! + +# wasmedge hello-p1.wasm +Hello, World! + +# wasmer hello-p1.wasm +Hello, World! + +# wasmi_cli hello-p1.wasm +Hello, World! + +# wazero run hello-p1.wasm +Hello, World! + +# iwasm hello-p1.wasm +Hello, World! +``` + +### wasm32-wasip2 + +Generate WASM files for target `wasm32-wasip2`: + +```bash +# /opt/wasi-sdk-23/bin/clang -v -Wl,--version --target=wasm32-wasip2 + +# /opt/wasi-sdk-23/bin/clang --target=wasm32-wasip2 -o hello-p2.wasm hello.c + +# file hello-p2.wasm +hello-p2.wasm: WebAssembly (wasm) binary module version 0x1000d +``` + +#### wasmtime + +Earlier versions of `wasmtime` would report an error: + +```bash +# wasmtime hello-p2.wasm +Error: cannot execute a component without `--wasm component-model` +``` + +The new version of `wasmtime` has no problem: + +```bash +# wasmtime hello-p1.wasm +Hello, World! +``` + +#### wasmedge + +`wasmedge` runs with an error, requiring component model support to be enabled: + +```bash +# wasmedge hello-p2.wasm +[error] loading failed: illegal opcode, Code: 0x117 +[error] This instruction or syntax requires enabling Component Model proposal +[error] Bytecode offset: 0x00000004 +[error] At AST node: component +[error] File name: "hello-p2.wasm" +``` + +In fact, it is still unsuccessful to enable support for the component model: + +```bash +root@wsl2-leap:~# wasmedge --enable-component hello-p2.wasm +[warning] component model is enabled, this is experimental. +[warning] component model is an experimental proposal +[error] Might an invalid wasm file +[error] loading failed: magic header not detected, Code: 0x103 +[error] Bytecode offset: 0x000410a9 +[error] At AST node: component +[error] At AST node: component +[error] File name: "hello-p2.wasm" +``` + +#### wasmer + +`wasmer` does not support **WASI 0.2** yet: + +```bash +# wasmer run hello-p2.wasm +error: Unable to compile "hello-p2.wasm" +╰─▶ 1: compile error +``` + +#### wasmi + +`wasmi` does not support **WASI 0.2** yet: + +```bash +# wasmi_cli hello-p2.wasm +Error: failed to parse and validate Wasm module "hello-p2.wasm": unknown binary version: 0xd, note: the WebAssembly component model feature is not enabled (at offset 0x0) +``` + +#### wazero + +`wazero` does not support **WASI 0.2** yet: + +```bash +# wazero run hello-p2.wasm +error compiling wasm binary: invalid version header +``` + +#### WebAssembly Micro Runtime + +**WebAssembly Micro Runtime** does not support WASI 0.2 yet: + +```bash +# iwasm hello-p2.wasm +WASM module load failed: unknown binary version +``` + +## Rust + +Let's test each WASI implementation with a **Rust** implementation of the classic **Hello World** program: + +### hello.rs + +```rust +fn main() { + println!("Hello, World!"); +} +``` + +### wasm32-wasip1 + +Generate WASM files for target `wasm32-wasip1`: + +```bash +# rustc -v --target wasm32-wasip1 -o hello-p1.wasm hello.rs + +# file hello-p1.wasm +hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) +``` + +All 6 WASI implementations used in this article support the target `wasm32-wasip1`: + +```bash +# wasmtime hello-p1.wasm +Hello, World! + +# wasmedge hello-p1.wasm +Hello, World! + +# wasmer hello-p1.wasm +Hello, World! + +# wasmi_cli hello-p1.wasm +Hello, World! + +# wazero run hello-p1.wasm +Hello, World! + +# iwasm hello-p1.wasm +Hello, World! +``` + +### wasm32-wasip2 + +Generate WASM files for target wasm32-wasip2: + +```bash +# rustc -v --target wasm32-wasip1 -o hello-p1.wasm hello.rs + +# file hello-p1.wasm +hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) +``` + +## Wrapping Up + +The component model is expected to add `future` and `stream` keywords, which will provide integrated and composable `async` functionality. WASI Preview 3 is planned to be a major revision of the Preview 2 APIs using these new features in place of `wasi-io`'s streams and polling interfaces. It's also expected to incorporate lessons learned from implementation and user experience with Preview 2. + +When Preview 3 is launched, implementations may continue to support Preview 2, either by implementing Preview 3 along side it, or by virtualizing (polyfilling) Preview 2 in terms of Preview 3. + +The release criteria of Preview 3 will include that performance will be measured and addressed. + +## Reference + +- [WASI-enabled WebAssembly C/C++ toolchain - https://github.com/WebAssembly/wasi-sdk/](https://github.com/WebAssembly/wasi-sdk/) +- [WASI Preview 2 - https://github.com/WebAssembly/WASI/tree/main/preview2](https://github.com/WebAssembly/WASI/tree/main/preview2) +- [Changes to Rust's WASI targets - https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) +- [New Tier-3 target: wasm32-wasi-preview2 - https://github.com/rust-lang/compiler-team/issues/694](https://github.com/rust-lang/compiler-team/issues/694) +- [Promote wasm32-wasip2 to a Tier 2 target - https://github.com/rust-lang/compiler-team/issues/760](https://github.com/rust-lang/compiler-team/issues/760) +- [Promote the wasm32-wasip2 target to Tier 2 - https://github.com/rust-lang/rust/pull/126967](https://github.com/rust-lang/rust/pull/126967) +- [Rust Platform Support - target wasm32-wasip2 - https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip2.html](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip2.html) +- [A stream of consciousness on the future of async in the Component Model by Luke Wagner @ Wasm I/O 24 - https://www.youtube.com/watch?v=y3x4-nQeXxc](https://www.youtube.com/watch?v=y3x4-nQeXxc)