#1128289 musl-tools: musl-gcc wrapper incorrectly references x86_64 compiler on arm64

Package:
musl-tools
Source:
musl-tools
Description:
standard C library tools
Submitter:
Leslie, Gianni
Date:
2026-02-17 14:03:02 UTC
Severity:
normal
#1128289#5
Date:
2026-02-17 14:00:00 UTC
From:
To:
Dear Maintainer,

On arm64 hosts, the musl-gcc wrapper script incorrectly references the
x86_64 compiler instead of the arm64 compiler.

Environment:
- Docker image: public.ecr.aws/docker/library/rust:slim (arm64)
- Building Rust project with target aarch64-unknown-linux-musl
- RUSTFLAGS="-C linker=musl-gcc" CC="musl-gcc"

Steps to reproduce:
1. Run arm64 rust:slim container on native arm64 host
2. Install musl-tools: apt-get install musl-tools
3. Check /usr/bin/musl-gcc contents

Actual result:
The wrapper contains:
  exec "${REALGCC:-x86_64-linux-gnu-gcc}" "$@" -specs "/usr/lib/x86_64-linux-musl/musl-gcc.specs"

Expected result:
On arm64, it should contain:
  exec "${REALGCC:-aarch64-linux-gnu-gcc}" "$@" -specs "/usr/lib/aarch64-linux-musl/musl-gcc.specs"

This causes compilation failures with architecture-specific flags:
  cc1: error: bad value 'armv8.4-a+sha3' for '-march=' switch
  cc1: note: valid arguments are: nocona core2 ... x86-64 ...

Suggested fix:
The package should detect host architecture and create the appropriate
wrapper pointing to the correct compiler and specs file.

Workaround:
Manually recreate the wrapper after installation:
  echo '#!/bin/sh' > /usr/bin/musl-gcc
  echo 'exec "${REALGCC:-aarch64-linux-gnu-gcc}" "$@" -specs "/usr/lib/aarch64-linux-musl/musl-gcc.specs"' >> /usr/bin/musl-gcc <https://aka.ms/GetOutlookForMac>