Skip to content

ubuntu-22.04-cross-arm-alpine container missing armv7-alpine-linux-musleabihf-* toolchain symlinks #1468

Description

@udlose

ubuntu-22.04-cross-arm-alpine container missing armv7-alpine-linux-musleabihf-* toolchain symlinks

Summary

The ubuntu-22.04-cross-arm-alpine container has a toolchain naming mismatch that prevents .NET 6 runtime builds from succeeding. CMake expects armv7-alpine-linux-musleabihf-* tools but the container only provides armv7-alpine-linux-musl-* tools, causing build failures.

Environment

  • Container Image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm-alpine
  • Build Target: .NET 6 Runtime (dotnet/runtime v6.0.36)
  • Architecture: ARM32 (cross-compilation from x64)
  • Build System: CMake + MSBuild
  • Build Configuration: Release
  • Target OS: Linux
  • Runtime Flavor: CoreCLR
  • ROOTFS_DIR: /crossrootfs/arm

Expected Behavior

The container should provide cross-compilation tools with the naming convention that CMake expects:

  • armv7-alpine-linux-musleabihf-objcopy
  • armv7-alpine-linux-musleabihf-gcc
  • armv7-alpine-linux-musleabihf-g++
  • etc.

Actual Behavior

The build fails during the CoreCLR native compilation phase with this exact error:

Invoking "/__w/dotnet-nes-build/dotnet-nes-build/rt/eng/native/gen-buildsys.sh" "/__w/dotnet-nes-build/dotnet-nes-build/rt/src/coreclr" "/__w/dotnet-nes-build/dotnet-nes-build/rt/artifacts/obj/coreclr/Linux.arm.Release" arm clang "" "" Release ""  -DCLR_CMAKE_PGO_INSTRUMENT=0 -DCLR_CMAKE_OPTDATA_PATH= -DCLR_CMAKE_PGO_OPTIMIZE=1 -DFEATURE_DISTRO_AGNOSTIC_SSL=1

CMake Error at /__w/dotnet-nes-build/dotnet-nes-build/rt/eng/native/configuretools.cmake:37 (message):
  Unable to find toolchain executable.  Name: objcopy, Prefix:
  armv7-alpine-linux-musleabihf-.
Call Stack (most recent call first):
  /__w/dotnet-nes-build/dotnet-nes-build/rt/eng/native/configuretools.cmake:63 (locate_toolchain_exec)
  /__w/dotnet-nes-build/dotnet-nes-build/rt/eng/native/configurecompiler.cmake:1 (include)
  CMakeLists.txt:19 (include)

-- Configuring incomplete, errors occurred!
make: *** No rule to make target 'install'.  Stop.
##vso[task.logissue type=error]Failed to build "CoreCLR component".

Build Command That Fails:

./build.sh \
  --restore \
  --build \
  --subset clr+libs+host+packs \
  --os Linux \
  --arch arm \
  --ci \
  --pack \
  --cross \
  --runtimeFlavor coreclr \
  --configuration Release \
  --librariesConfiguration Release \
  --runtimeConfiguration Release \
  /p:OfficialBuildId=XXXXXXXX.YY

Evidence of the Problem

Investigation of the container shows the tools exist but with incorrect naming:

Container Investigation Results

# ROOTFS_DIR is correctly set up
$ ls -la /crossrootfs/arm/
drwxr-xr-x 19 root root 4096 Feb  4 21:00 .
drwxr-xr-x  3 root root 4096 Feb  4 21:08 ..
drwxr-xr-x  2 root root 4096 Feb  4 21:00 bin
# ... (complete Alpine rootfs structure exists)

# Alternative toolchain exists in crossrootfs but with different path
$ find /crossrootfs/arm -name "*objcopy*" 2>/dev/null
/crossrootfs/arm/usr/bin/objcopy
/crossrootfs/arm/usr/armv7-alpine-linux-musleabihf/bin/objcopy  # ✅ Correct name but wrong PATH

Available Tools (Wrong Names)

$ find /usr -name "*objcopy*" 2>/dev/null
/usr/bin/armv7-alpine-linux-musl-objcopy     # ❌ Wrong name
/usr/bin/arm-linux-gnueabihf-objcopy
/usr/bin/objcopy
...

$ find /usr -name "*arm*" -type f -executable 2>/dev/null | head -10
/usr/bin/armv7-alpine-linux-musl-ld          # ❌ All have 'musl' not 'musleabihf'
/usr/bin/armv7-alpine-linux-musl-ar
/usr/bin/armv7-alpine-linux-musl-objcopy
/usr/bin/armv7-alpine-linux-musl-gcc
...

Expected Tools (Missing)

$ command -v armv7-alpine-linux-musleabihf-objcopy
# (not found)

Workaround Confirmation

Creating symlinks resolves the issue:

$ ln -sf /usr/bin/armv7-alpine-linux-musl-objcopy /usr/bin/armv7-alpine-linux-musleabihf-objcopy
$ command -v armv7-alpine-linux-musleabihf-objcopy
/usr/bin/armv7-alpine-linux-musleabihf-objcopy
$ armv7-alpine-linux-musleabihf-objcopy --version
GNU objcopy (GNU Binutils) 2.39

Comparison with Working ARM64 Container

The ARM64 equivalent (ubuntu-22.04-cross-arm64-alpine) works correctly and uses the musl naming convention (not musleabihf), but CMake expects different conventions for ARM32 vs ARM64:

  • ARM64 Expected: aarch64-alpine-linux-musl-* ✅ (matches what's available)
  • ARM32 Expected: armv7-alpine-linux-musleabihf-* ❌ (doesn't match what's available)

This suggests the ARM32 container build process is missing the creation of the expected symlinks.

Impact

  • Blocks .NET 6 runtime builds for ARM32 Alpine targets
  • Affects any project using this container for ARM32 cross-compilation
  • ARM64 builds work fine (different naming convention)

Workaround

Add these symlinks in the build process:

ln -sf /usr/bin/armv7-alpine-linux-musl-objcopy /usr/bin/armv7-alpine-linux-musleabihf-objcopy
ln -sf /usr/bin/armv7-alpine-linux-musl-gcc /usr/bin/armv7-alpine-linux-musleabihf-gcc
ln -sf /usr/bin/armv7-alpine-linux-musl-g++ /usr/bin/armv7-alpine-linux-musleabihf-g++

Suggested Fix

The container should include symlinks for all armv7-alpine-linux-musl-* tools to their armv7-alpine-linux-musleabihf-* equivalents, similar to how other cross-compilation containers handle naming conventions.

References

Additional Context

This issue was discovered while building the .NET 6 runtime source.

Workflow Context:

  • Building in GitHub Actions using the official Microsoft container
  • Cross-compiling from Ubuntu 22.04 x64 host to ARM32 Alpine target
  • ARM64 equivalent job succeeds using ubuntu-22.04-cross-arm64-alpine container
  • Building multiple architectures: x64 ✅, ARM64 ✅, ARM32 ❌
  • Same build script and parameters work for all other architectures

GitHub Actions Environment:

container:
  image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm-alpine
  options: --user root
env:
  BUILD_ARCH: 'arm'
  RUNTIME_FLAVOR: 'coreclr'
  ROOTFS_DIR: '/crossrootfs/arm'

The ARM64 equivalent build works perfectly, suggesting this is a container-specific issue rather than a fundamental toolchain problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions