Skip to content
Open
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
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,14 @@ jobs:
- os: ubuntu-22.04
target: s390x-unknown-linux-musl
container: '{"image": "messense/rust-musl-cross:s390x-musl"}'
rustflags: -Ctarget-feature=+crt-static
Comment thread
Xeonacid marked this conversation as resolved.
lto: "false"
- os: ubuntu-22.04
target: s390x-unknown-linux-gnu
- os: ubuntu-22.04
target: riscv64gc-unknown-linux-musl
container: '{"image": "messense/rust-musl-cross:riscv64gc-musl"}'
rustflags: -Ctarget-feature=+crt-static
lto: "false"
- os: ubuntu-22.04
binary: sccache-dist
Expand Down Expand Up @@ -356,6 +358,20 @@ jobs:
RUSTFLAGS: ${{ env.RUSTFLAGS || matrix.rustflags }}
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.lto || 'true' }}

- name: Verify static linking for musl artifacts
if: ${{ contains(matrix.target, '-unknown-linux-musl') }}
run: |
BINARY="target/${{ matrix.target }}/release/${{ matrix.binary || 'sccache' }}"
[ -f "$BINARY" ] || { echo "Error: expected binary not found at $BINARY"; exit 1; }
NEEDED_PATTERN='^[[:space:]]*0x[0-9a-fA-F]+[[:space:]]+\(NEEDED\)[[:space:]]+Shared library:'
DYNAMIC_SECTION="$(readelf -d "$BINARY")"
Comment thread
Xeonacid marked this conversation as resolved.
echo "$DYNAMIC_SECTION"
if echo "$DYNAMIC_SECTION" | grep -Eq "$NEEDED_PATTERN"; then
echo "Expected a statically linked musl binary, but found dynamic dependencies:"
echo "$DYNAMIC_SECTION" | grep -E "$NEEDED_PATTERN"
exit 1
fi

# Workaround for the lack of substring() function in github actions expressions.
- name: Id
id: id
Expand Down
Loading