Browse Source

Add release binaries for x86_64-musl (#8668)

* Add release binaries for x86_64-musl

This was requested in bytecodealliance/wasmtime-py#237 and shouldn't
cost us too much in terms of CI resources and maintenance overhead.

* Fix combining rustflags

prtest:full
pull/8669/head
Alex Crichton 6 months ago
committed by GitHub
parent
commit
cc93e8f7f0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ci/build-build-matrix.js
  2. 2
      ci/build-release-artifacts.sh
  3. 17
      ci/docker/x86_64-musl/Dockerfile
  4. 4
      crates/wasmtime/build.rs
  5. 6
      docs/stability-tiers.md

5
ci/build-build-matrix.js

@ -59,6 +59,11 @@ const array = [
"os": "ubuntu-latest", "os": "ubuntu-latest",
"target": "x86_64-linux-android", "target": "x86_64-linux-android",
}, },
{
"build": "x86_64-musl",
"os": "ubuntu-latest",
"target": "x86_64-unknown-linux-musl",
},
]; ];
const builds = []; const builds = [];

2
ci/build-release-artifacts.sh

@ -25,7 +25,7 @@ if [[ "$build" = *-min ]]; then
# Configure a whole bunch of compile-time options which help reduce the size # Configure a whole bunch of compile-time options which help reduce the size
# of the binary artifact produced. # of the binary artifact produced.
export CARGO_PROFILE_RELEASE_OPT_LEVEL=s export CARGO_PROFILE_RELEASE_OPT_LEVEL=s
export RUSTFLAGS=-Zlocation-detail=none export RUSTFLAGS="-Zlocation-detail=none $RUSTFLAGS"
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO=true export CARGO_PROFILE_RELEASE_LTO=true
build_std=-Zbuild-std=std,panic_abort build_std=-Zbuild-std=std,panic_abort

17
ci/docker/x86_64-musl/Dockerfile

@ -0,0 +1,17 @@
# Rust binaries need `libgcc_s.so` but ubuntu's musl toolchain does not have it.
# Get it from alpine instead.
FROM alpine:3.16 as libgcc_s_src
RUN apk add libgcc
# Use something glibc-based for the actual compile because the Rust toolchain
# we're using is glibc-based in CI.
FROM ubuntu:24.04
RUN apt-get update -y && apt-get install -y cmake musl-tools
COPY --from=libgcc_s_src /usr/lib/libgcc_s.so.1 /usr/lib/x86_64-linux-musl
ENV PATH=$PATH:/rust/bin
# Note that `-crt-feature` is passed here to specifically disable static linking
# with musl. We want a `*.so` to pop out so static linking isn't what we want.
ENV RUSTFLAGS=-Ctarget-feature=-crt-static
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc

4
crates/wasmtime/build.rs

@ -35,4 +35,8 @@ fn build_c_helpers() {
println!("cargo:rerun-if-changed=src/runtime/vm/helpers.c"); println!("cargo:rerun-if-changed=src/runtime/vm/helpers.c");
build.file("src/runtime/vm/helpers.c"); build.file("src/runtime/vm/helpers.c");
build.compile("wasmtime-helpers"); build.compile("wasmtime-helpers");
if os == "linux" {
println!("cargo:rustc-link-lib=m");
}
} }

6
docs/stability-tiers.md

@ -91,6 +91,7 @@ For explanations of what each tier means see below.
| Target | `wasm32-wasi` [^3] | Supported but not tested | | Target | `wasm32-wasi` [^3] | Supported but not tested |
| Target | `aarch64-linux-android` | CI testing, full-time maintainer | | Target | `aarch64-linux-android` | CI testing, full-time maintainer |
| Target | `x86_64-linux-android` | CI testing, full-time maintainer | | Target | `x86_64-linux-android` | CI testing, full-time maintainer |
| Target | `x86_64-unknown-linux-musl` [^4] | CI testing, full-time maintainer |
| Compiler Backend | Winch on aarch64 | finished implementation | | Compiler Backend | Winch on aarch64 | finished implementation |
| WebAssembly Proposal | [`gc`] | Complete implementation | | WebAssembly Proposal | [`gc`] | Complete implementation |
| WASI Proposal | [`wasi-nn`] | More expansive CI testing | | WASI Proposal | [`wasi-nn`] | More expansive CI testing |
@ -119,6 +120,11 @@ as well.
but not the `runtime` feature at this time. This means that but not the `runtime` feature at this time. This means that
Wasmtime-compiled-to-wasm can itself compile wasm but cannot execute wasm. Wasmtime-compiled-to-wasm can itself compile wasm but cannot execute wasm.
[^4]: Binary artifacts for MUSL are dynamically linked, not statically
linked, meaning that they are not suitable for "run on any linux distribution"
style use cases. Wasmtime does not have static binary artifacts at this time and
that will require building from source.
#### Unsupported features and platforms #### Unsupported features and platforms
While this is not an exhaustive list, Wasmtime does not currently have support While this is not an exhaustive list, Wasmtime does not currently have support

Loading…
Cancel
Save