Skip to content

Provide arm64 linux binaries #1599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
89cff05
add Docker, sources.list, and toolchain.cmake
Feb 10, 2025
324bad5
Merge remote-tracking branch 'upstream/main' into build_arm64
Feb 10, 2025
f8a5d45
hookup new binary to signing workflow
Feb 21, 2025
25f1fbd
add a arm64 ci runs
Feb 21, 2025
f1d9ac2
fix ubuntu version
Feb 24, 2025
341e129
add test presets
Feb 24, 2025
097aa88
skip nuget export test on arm64 to bypass mono dep
Feb 25, 2025
f948f63
use RuntimeInformation to determine arch
Feb 27, 2025
dcc2ce4
hookup toolchain file
Mar 14, 2025
8964389
add glibc-devel
Mar 14, 2025
d2e2e08
update signing.yml to use new image with glibc-devel package
Mar 14, 2025
80a219a
fix broken link and add newline
Mar 14, 2025
f0a8494
add libc6-devel
Mar 14, 2025
ef6caad
add libc6-devel from crossrootfs
Mar 15, 2025
8bd0e85
add -L/crossrootfs/arm64/lib/aarch64-linux-gnu
Mar 15, 2025
8b15750
fix syntax bug in signing.yml
Mar 18, 2025
17d874f
remove redundant toolchain linker flags from toolchain
Mar 18, 2025
379ff90
run end to end tests for nuget
Mar 18, 2025
7aa6b6d
use newer image
Mar 18, 2025
b824a73
undo merge
Mar 18, 2025
08bce98
install mono-complete for arm64-linux
Mar 18, 2025
9615efd
restore commands.export.ps1
Mar 18, 2025
cd12a11
Add some missing vcpkg-glibc-arm64s causing the file to be missing fr…
BillyONeal Mar 19, 2025
eae41ab
Merge remote-tracking branch 'origin/main' into build_arm64
BillyONeal Mar 20, 2025
2b8177a
Bill can't fix freaking merge conflicts, Bill is an idiot
BillyONeal Mar 20, 2025
4b12fb8
Bill still can't fix merge conflicts.
BillyONeal Mar 20, 2025
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
7 changes: 7 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
preset: windows-ci
- os: ubuntu-22.04
preset: linux-ci
- os: ubuntu-24.04-arm
preset: linux-arm64-ci
- os: macos-13
preset: macos-ci
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -76,6 +78,11 @@ jobs:
path: ${{ github.workspace }}/vcpkg-root
repository: microsoft/vcpkg
ref: ${{ steps.vcpkg_sha.outputs.VCPKG_SHA }}
- name: Install Mono (for NuGet export)
if: matrix.preset == 'linux-arm64-ci'
run: |
sudo apt update
sudo apt install -y mono-complete
- name: Run vcpkg end-to-end tests
shell: pwsh
run: |
Expand Down
15 changes: 15 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@
"VCPKG_WARNINGS_AS_ERRORS": true
}
},
{
"name": "linux-arm64-ci",
"inherits": [ "linux-ci" ],
"cacheVariables": {
"CMAKE_SYSTEM_PROCESSOR": "aarch64"
}
},
{
"name": "linux-codespaces",
"inherits": [
Expand Down Expand Up @@ -214,6 +221,10 @@
"name": "linux-ci",
"configurePreset": "linux-ci"
},
{
"name": "linux-arm64-ci",
"configurePreset": "linux-arm64-ci"
},
{
"name": "linux-codespaces",
"configurePreset": "linux-codespaces"
Expand All @@ -232,6 +243,10 @@
"name": "linux-ci",
"configurePreset": "linux-ci"
},
{
"name": "linux-arm64-ci",
"configurePreset": "linux-arm64-ci"
},
{
"name": "linux-codespaces",
"configurePreset": "linux-codespaces"
Expand Down
3 changes: 3 additions & 0 deletions azure-pipelines/binary-signing.signproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg-glibc">
<Authenticode>LinuxSign</Authenticode>
</FilesToSign>
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg-glibc-arm64">
<Authenticode>LinuxSign</Authenticode>
</FilesToSign>
<FilesToSign Include="$(IntermediateOutputPath)\vcpkg-muslc">
<Authenticode>LinuxSign</Authenticode>
</FilesToSign>
Expand Down
45 changes: 45 additions & 0 deletions azure-pipelines/signing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,44 @@ extends:
mkdir -p "$(Agent.TempDirectory)/build"
docker run --rm --mount "type=bind,source=$(Build.Repository.LocalPath),target=/source,readonly" --mount "type=bind,source=$(Agent.TempDirectory)/build,target=/build" vcpkgdockercontainers.azurecr.io/vcpkg/vcpkg-alpine:3.16 sh -c "cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DCMAKE_CXX_FLAGS=\"-static -s -static-libgcc -static-libstdc++\" -DVCPKG_CMAKERC_URL=$(cmakerc-tarball-url) -DVCPKG_FMT_URL=$(fmt-tarball-url) -DVCPKG_STANDALONE_BUNDLE_SHA=$(VCPKG_STANDALONE_BUNDLE_SHA) -DVCPKG_BASE_VERSION=$(VCPKG_BASE_VERSION) -DVCPKG_VERSION=$(Build.SourceVersion) -S /source -B /build 2>&1 && ninja -C /build"
mv "$(Agent.TempDirectory)/build/vcpkg" "$(Build.ArtifactStagingDirectory)/vcpkg-muslc"
- job: glibc_arm64_build
displayName: 'glibc Arm64 Build'
dependsOn:
- arch_independent
pool:
name: 'vcpkg-mariner-aarch64-1espt'
os: linux
hostArchitecture: Arm64
variables:
VCPKG_STANDALONE_BUNDLE_SHA: $[ dependencies.arch_independent.outputs['shas.VCPKG_STANDALONE_BUNDLE_SHA'] ]
VCPKG_BASE_VERSION: $[ dependencies.arch_independent.outputs['versions.VCPKG_BASE_VERSION'] ]
templateContext:
sdl:
codeql:
language: cpp
buildIdentifier: vcpkg_cpp_glibc_arm64
mb:
signing:
enabled: false
outputs:
- output: pipelineArtifact
displayName: 'Publish Unsigned glibc Arm64 Binary'
artifactName: 'stagingGlibcArm64'
publishLocation: 'Container'
targetPath: '$(Build.ArtifactStagingDirectory)'
steps:
- bash: |
az login --identity --username 29a4d3e7-c7d5-41c7-b5a0-fee8cf466371
az acr login --name vcpkgdockercontainers
displayName: 'Set up managed identity'
- task: CmdLine@2
displayName: "Run Docker build for arm64 Linux binary"
inputs:
failOnStderr: false
script: |
mkdir -p "$(Agent.TempDirectory)/build"
docker run --rm --mount "type=bind,source=$(Build.Repository.LocalPath),target=/source,readonly" --mount "type=bind,source=$(Agent.TempDirectory)/build,target=/build" vcpkgdockercontainers.azurecr.io/vcpkg/vcpkg-arm64-linux:2025-03-18 sh -c "cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=/source/azure-pipelines/vcpkg-arm64/toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=ON -DVCPKG_WARNINGS_AS_ERRORS=ON -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_EMBED_GIT_SHA=ON -DVCPKG_OFFICIAL_BUILD=ON -DVCPKG_CMAKERC_URL=$(cmakerc-tarball-url) -DVCPKG_FMT_URL=$(fmt-tarball-url) -DVCPKG_STANDALONE_BUNDLE_SHA=$(VCPKG_STANDALONE_BUNDLE_SHA) -DVCPKG_BASE_VERSION=$(VCPKG_BASE_VERSION) -DVCPKG_VERSION=$(Build.SourceVersion) -S /source -B /build 2>&1 && ninja -C /build"
mv "$(Agent.TempDirectory)/build/vcpkg" "$(Build.ArtifactStagingDirectory)/vcpkg-glibc-arm64"
- job: windows_and_sign
displayName: 'Build Windows binaries and Sign'
timeoutInMinutes: 120
Expand All @@ -315,6 +353,7 @@ extends:
- macos_build
- glibc_build
- muslc_build
- glibc_arm64_build
pool:
name: 'VSEngSS-MicroBuild2022-1ES'
variables:
Expand Down Expand Up @@ -342,6 +381,9 @@ extends:
- input: pipelineArtifact
artifactName: stagingGlibc
targetPath: $(Build.ArtifactStagingDirectory)\stagingGlibc
- input: pipelineArtifact
artifactName: stagingGlibcArm64
targetPath: $(Build.ArtifactStagingDirectory)\stagingGlibcArm64
- input: pipelineArtifact
artifactName: stagingMuslc
targetPath: $(Build.ArtifactStagingDirectory)\stagingMuslc
Expand Down Expand Up @@ -400,6 +442,7 @@ extends:
mkdir "$(Build.BinariesDirectory)\build"
copy /Y "$(Build.ArtifactStagingDirectory)\stagingArchIndependent\vcpkg-init" "$(Build.BinariesDirectory)\vcpkg-init"
copy /Y "$(Build.ArtifactStagingDirectory)\stagingGlibc\vcpkg-glibc" "$(Build.BinariesDirectory)\vcpkg-glibc"
copy /Y "$(Build.ArtifactStagingDirectory)\stagingGlibcArm64\vcpkg-glibc-arm64" "$(Build.BinariesDirectory)\build\vcpkg-glibc-arm64"
copy /Y "$(Build.ArtifactStagingDirectory)\stagingMuslc\vcpkg-muslc" "$(Build.BinariesDirectory)\vcpkg-muslc"
- task: MSBuild@1
displayName: 'Sign Binaries'
Expand Down Expand Up @@ -454,6 +497,7 @@ extends:
move "$(Build.ArtifactStagingDirectory)\stagingArchIndependent\scripts\posh-vcpkg.psm1" "$(Build.ArtifactStagingDirectory)\drop\posh-vcpkg.psm1"
move "$(Build.ArtifactStagingDirectory)\stagingArchIndependent\scripts\posh-vcpkg.psd1" "$(Build.ArtifactStagingDirectory)\drop\posh-vcpkg.psd1"
move "$(Build.ArtifactStagingDirectory)\stagingGlibc\vcpkg-glibc" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-glibc"
move "$(Build.ArtifactStagingDirectory)\stagingGlibcArm64\vcpkg-glibc-arm64" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-glibc-arm64"
move "$(Build.ArtifactStagingDirectory)\stagingMuslc\vcpkg-muslc" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-muslc"
move "$(Build.ArtifactStagingDirectory)\stagingArchIndependent\vcpkg-standalone-bundle.tar.gz" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-standalone-bundle.tar.gz"

Expand Down Expand Up @@ -491,6 +535,7 @@ extends:
script: |
move "$(Build.BinariesDirectory)\vcpkg-init" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-init.sig"
move "$(Build.BinariesDirectory)\vcpkg-glibc" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-glibc.sig"
move "$(Build.BinariesDirectory)\vcpkg-glibc-arm64" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-glibc-arm64.sig"
move "$(Build.BinariesDirectory)\vcpkg-muslc" "$(Build.ArtifactStagingDirectory)\drop\vcpkg-muslc.sig"
- task: NuGetCommand@2
displayName: 'NuGet pack for VS Insertion'
Expand Down
59 changes: 59 additions & 0 deletions azure-pipelines/vcpkg-arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This infrastructure is adapted from that the .NET team uses, see
# https://github.com/dotnet/dotnet-buildtools-prereqs-docker
# and
# https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/README.md
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0

RUN tdnf install -y \
# Common utilities
ca-certificates \
git \
tar \
curl \
# Build tools
binutils \
cmake \
ninja-build \
# Rootfs build dependencies
bzip2-devel \
debootstrap \
libarchive-devel \
openssl-devel

# Obtain ubuntu package signing key (for use by debootstrap)
# 1. Download the ubuntu keyrings
RUN curl -L -o ubuntu-keyring_2021.03.26.tar.gz https://mirrors.edge.kernel.org/ubuntu/pool/main/u/ubuntu-keyring/ubuntu-keyring_2021.03.26.tar.gz && \
# 2. Check that they have the correct SHA
echo "492eed5c06408c6f632577adb0796130af5d6542013ef418f47187a209e49bb1 ubuntu-keyring_2021.03.26.tar.gz" | sha256sum -c && \
tar xf ubuntu-keyring_2021.03.26.tar.gz && \
rm ubuntu-keyring_2021.03.26.tar.gz && \
# 3. Install the needed keyring and delete the rest
pushd ubuntu-keyring-2021.03.26 && \
mkdir -p /usr/share/keyrings && \
mv keyrings/ubuntu-archive-keyring.gpg /usr/share/keyrings && \
popd && \
rm -r ubuntu-keyring-2021.03.26

# Build the 'crossrootfs'
# Note that we only need libstdc++-9-dev rather than all of g++-9, but choosing g++-9
# gets other optional dependencies to agree with g++-9 rather than older gccs
RUN debootstrap "--variant=minbase" --force-check-gpg --arch arm64 xenial /crossrootfs/arm64 http://ports.ubuntu.com/ubuntu-ports/
COPY sources.list .
RUN chroot /crossrootfs/arm64 apt-get clean && \
cp /etc/resolv.conf /crossrootfs/arm64/etc/resolv.conf && \
cp sources.list /crossrootfs/arm64/etc/apt/sources.list && \
chroot /crossrootfs/arm64 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F && \
chroot /crossrootfs/arm64 apt-get update -o Acquire::CompressionTypes::Order::=gz && \
chroot /crossrootfs/arm64 apt-get install -y libc6-dev

# Repeated runs of apt-get install workaround 'hash sum mismatch' errors
# (This is also why these are a separate cache layer)
RUN chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" || \
chroot /crossrootfs/arm64 apt-get install -y build-essential symlinks "g++-9" && \
chroot /crossrootfs/arm64 symlinks -cr /usr && \
chroot /crossrootfs/arm64 apt-get clean
14 changes: 14 additions & 0 deletions azure-pipelines/vcpkg-arm64/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
deb http://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu xenial main
deb-src http://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu xenial main

deb http://ports.ubuntu.com/ubuntu-ports xenial main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports xenial main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports xenial-updates main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-updates main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports xenial-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-backports main restricted

deb http://ports.ubuntu.com/ubuntu-ports xenial-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-security main restricted universe multiverse
28 changes: 28 additions & 0 deletions azure-pipelines/vcpkg-arm64/toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(CMAKE_SYSTEM_NAME Linux)
set(LINUX 1)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSROOT "/crossrootfs/arm64")
set(COMMON_ARGS "-B/crossrootfs/arm64/usr/lib/aarch64-linux-gnu/ -isystem /crossrootfs/arm64/usr/lib/gcc/aarch64-linux-gnu/9/include-fixed -isystem /crossrootfs/arm64/usr/lib/gcc/aarch64-linux-gnu/9/include -isystem /crossrootfs/arm64/usr/include/aarch64-linux-gnu -isystem /crossrootfs/arm64/usr/include -static-libgcc -nostdinc")
set(CMAKE_C_FLAGS_INIT "${COMMON_ARGS}")
set(CMAKE_CXX_FLAGS_INIT "-isystem /crossrootfs/arm64/usr/include/aarch64-linux-gnu/c++/9 -isystem /crossrootfs/arm64/usr/include/c++/9 ${COMMON_ARGS} -static-libstdc++ -L/crossrootfs/arm64/usr/lib/gcc/aarch64-linux-gnu/9/")
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "/crossrootfs/arm64/usr")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "/crossrootfs/arm64/usr")
set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "/crossrootfs/arm64/usr")
function(add_toolchain_linker_flag Flag)
set("CMAKE_EXE_LINKER_FLAGS_INIT" "${CMAKE_EXE_LINKER_FLAGS_INIT} ${Flag}" PARENT_SCOPE)
set("CMAKE_SHARED_LINKER_FLAGS_INIT" "${CMAKE_SHARED_LINKER_FLAGS_INIT} ${Flag}" PARENT_SCOPE)
endfunction()

add_toolchain_linker_flag("-Wl,--rpath-link=/crossrootfs/arm64/lib/aarch64-linux-gnu")
add_toolchain_linker_flag("-Wl,--rpath-link=/crossrootfs/arm64/usr/lib/aarch64-linux-gnu")
add_toolchain_linker_flag("-L/crossrootfs/arm64/usr/lib/aarch64-linux-gnu")


set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Loading