Skip to content

Commit 2a8fd3c

Browse files
authored
fix: added musl builds x86_64 and aarch64 (#2259)
* fix: added musl builds x86_64 and aarch64 Signed-off-by: Thomas Timmer <thomastimmer11@hotmail.com> * feat: copy wasmtime ci docker images * chore: copy over the correct musl docker image * fix: rename EXTRA_RUSTFLAGS to RUSTFLAGS * Revert "fix: rename EXTRA_RUSTFLAGS to RUSTFLAGS" This reverts commit 9ff1f40. --------- Signed-off-by: Thomas Timmer <thomastimmer11@hotmail.com> Co-authored-by: Thomas Timmer <thomas.timmer@bettyblocks.com>
1 parent 847d7db commit 2a8fd3c

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
include:
3030
- build: x86_64-linux
3131
os: ubuntu-latest
32+
- build: x86_64-musl
33+
os: ubuntu-latest
34+
target: x86_64-unknown-linux-musl
3235
- build: x86_64-macos
3336
os: macos-latest
3437
target: x86_64-apple-darwin
@@ -40,6 +43,9 @@ jobs:
4043
- build: aarch64-linux
4144
os: ubuntu-latest
4245
target: aarch64-unknown-linux-gnu
46+
- build: aarch64-musl
47+
os: ubuntu-latest
48+
target: aarch64-unknown-linux-musl
4349
- build: wasm32-wasip1
4450
os: ubuntu-latest
4551
target: wasm32-wasip1

ci/docker/aarch64-musl/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ghcr.io/cross-rs/aarch64-unknown-linux-musl
2+
3+
RUN apt-get update -y && apt-get install -y ninja-build
4+
RUN git config --global --add safe.directory '*'
5+
ENV EXTRA_RUSTFLAGS=-Ctarget-feature=-crt-static

ci/docker/x86_64-musl/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Rust binaries need `libgcc_s.so` but ubuntu's musl toolchain does not have it.
2+
# Get it from alpine instead.
3+
FROM alpine:3.16 as libgcc_s_src
4+
RUN apk add libgcc
5+
6+
# Use something glibc-based for the actual compile because the Rust toolchain
7+
# we're using is glibc-based in CI.
8+
FROM ubuntu:24.04
9+
RUN apt-get update -y && apt-get install -y cmake musl-tools git ninja-build
10+
COPY --from=libgcc_s_src /usr/lib/libgcc_s.so.1 /usr/lib/x86_64-linux-musl
11+
RUN git config --global --add safe.directory '*'
12+
13+
# Note that `-crt-feature` is passed here to specifically disable static linking
14+
# with musl. We want a `*.so` to pop out so static linking isn't what we want.
15+
ENV EXTRA_RUSTFLAGS=-Ctarget-feature=-crt-static
16+
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc

0 commit comments

Comments
 (0)