Skip to content

Commit 6755c1d

Browse files
Add arm64 build
1 parent 0a637a0 commit 6755c1d

14 files changed

+94
-31
lines changed

eng/liveBuilds.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
does not scale for local development because it requires you to build the same host tools for each target configuration.
3333
E. g. you need to build the same Debug compiler 3 times if you want to compile code in Debug, Checked and Release. -->
3434
<IlcConfig Condition="'$(IlcConfig)' == ''">$(CoreCLRConfiguration)</IlcConfig>
35-
<CoreCLRCrossILCompilerDir Condition="'$(CoreCLRCrossILCompilerDir)' != '' and '$(TargetsWasm)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(HostOS).$(BuildArchitecture).$(IlcConfig)', 'ilc'))</CoreCLRCrossILCompilerDir>
35+
<IlcHostArch Condition="'$(IlcHostArch)' == ''">$(BuildArchitecture)</IlcHostArch>
36+
<CoreCLRCrossILCompilerDir Condition="'$(CoreCLRCrossILCompilerDir)' != '' and '$(TargetsWasm)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(HostOS).$(IlcHostArch).$(IlcConfig)', 'ilc'))</CoreCLRCrossILCompilerDir>
3637

3738
<Crossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2-published'))</Crossgen2Dir>
3839
<Crossgen2InBuildDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'crossgen2'))</Crossgen2InBuildDir>

eng/pipelines/common/global-build-job.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ jobs:
207207
- ${{ if ne(parameters.hostedOs, 'windows') }}:
208208
- script: /tmp/docker exec -t -u 0 naot-llvm-ci-container sh -c "tdnf install -y sudo"
209209
displayName: Install sudo
210-
- script: $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-build-and-test-tools.sh $(Build.SourcesDirectory)/wasm-tools
210+
- script: $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-build-and-test-tools.sh
211211
displayName: Install NativeAOT-LLVM build and test tools
212212
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-emscripten.ps1 $(Build.SourcesDirectory)/wasm-tools -CI
213213
displayName: Install/activate emscripten
214214
- ${{ if eq(parameters.hostedOs, 'windows') }}:
215215
- script: call $(Build.SourcesDirectory)/eng/pipelines/runtimelab/set-cmake-path.cmd
216216
displayName: Set CMake path
217-
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-llvm.ps1 -CloneDir $(Build.SourcesDirectory)/wasm-tools -Configs ${{ parameters.buildConfig }} -CI
217+
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-llvm.ps1 -CloneDir $(Build.SourcesDirectory)/wasm-tools -Configs $(_BuildConfig) -Arch $(hostedTargetArch) -CI
218218
displayName: Install/build LLVM
219219
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-nodejs.ps1 $(Build.SourcesDirectory)/wasm-tools
220220
displayName: Install NodeJS

eng/pipelines/common/platform-matrix.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ jobs:
514514
targetRid: browser-wasm
515515
platform: browser_wasm_linux_x64_naot_llvm
516516
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
517-
container: linux_x64_sanitizer_naot_llvm
517+
container: linux_x64_naot_llvm
518518
jobParameters:
519519
hostedOs: linux
520520
runtimeFlavor: ${{ parameters.runtimeFlavor }}
@@ -533,14 +533,35 @@ jobs:
533533
targetRid: wasi-wasm
534534
platform: wasi_wasm_linux_x64_naot_llvm
535535
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
536-
container: linux_x64_sanitizer_naot_llvm
536+
container: linux_x64_naot_llvm
537537
jobParameters:
538538
hostedOs: linux
539539
runtimeFlavor: ${{ parameters.runtimeFlavor }}
540540
stagedBuild: ${{ parameters.stagedBuild }}
541541
buildConfig: ${{ parameters.buildConfig }}
542542
${{ insert }}: ${{ parameters.jobParameters }}
543543

544+
- ${{ if containsValue(parameters.platforms, 'browser_wasm_linux_arm64_naot_llvm') }}:
545+
- template: xplat-setup.yml
546+
parameters:
547+
jobTemplate: ${{ parameters.jobTemplate }}
548+
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
549+
variables: ${{ parameters.variables }}
550+
osGroup: browser
551+
archType: wasm
552+
targetRid: browser-wasm
553+
platform: browser_wasm_linux_arm64_naot_llvm
554+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
555+
container: linux_arm64_naot_llvm
556+
jobParameters:
557+
hostedOs: linux
558+
hostedTargetArch: arm64
559+
nameSuffix: arm64
560+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
561+
stagedBuild: ${{ parameters.stagedBuild }}
562+
buildConfig: ${{ parameters.buildConfig }}
563+
${{ insert }}: ${{ parameters.jobParameters }}
564+
544565
# Browser WebAssembly
545566

546567
- ${{ if containsValue(parameters.platforms, 'browser_wasm') }}:

eng/pipelines/common/templates/pipeline-with-resources.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,19 @@ extends:
8282
# We need to be able to use 'tdnf install'. We can't because of https://github.com/dotnet/dotnet-docker/issues/788.
8383
# This is the hackaround: https://github.com/microsoft/azure-pipelines-agent/issues/2043#issuecomment-489692810.
8484
# TODO-LLVM-Upstream: replace with an image that has our prerequisites (LLDB) already installed.
85-
linux_x64_sanitizer_naot_llvm:
86-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64-sanitizer
85+
linux_x64_naot_llvm:
86+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-amd64-sanitizer
8787
options: '--name naot-llvm-ci-container -v /usr/bin/docker:/tmp/docker:ro'
8888
env:
8989
ROOTFS_DIR: /crossrootfs/x64
9090

91+
# For arm64, we need to install QEMU.
92+
linux_arm64_naot_llvm:
93+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-arm64
94+
options: '--name naot-llvm-ci-container -v /usr/bin/docker:/tmp/docker:ro'
95+
env:
96+
ROOTFS_DIR: /crossrootfs/arm64
97+
9198
# We use a CentOS Stream 8 image here to test building from source on CentOS Stream 9.
9299
SourceBuild_centos_x64:
93100
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9

eng/pipelines/common/xplat-setup.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ jobs:
5252
- name: osSubgroup
5353
value: ${{ parameters.osSubgroup }}
5454

55+
- name: hostedTargetArch
56+
${{ if ne(parameters.jobParameters.hostedTargetArch, '') }}:
57+
value: ${{ parameters.jobParameters.hostedTargetArch }}
58+
${{ else }}:
59+
value: x64
60+
5561
- name: _runSmokeTestsOnlyArg
5662
value: '/p:RunSmokeTestsOnly=$(isRunSmokeTestsOnly)'
5763

eng/pipelines/runtimelab.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ extends:
105105
- wasi_wasm_win
106106
- browser_wasm_linux_x64_naot_llvm
107107
- wasi_wasm_linux_x64_naot_llvm
108+
- browser_wasm_linux_arm64_naot_llvm
108109
jobParameters:
109110
timeoutInMinutes: 300
110111
buildArgs: -s clr.aot+libs -c $(_BuildConfig)
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
3-
dir=$(dirname "$0")
4-
echo; $dir/install-python.sh
5-
echo; $dir/install-lldb.sh
3+
4+
echo Setting EMSDK_PYTHON to /usr/bin/python3
5+
echo '##vso[task.setvariable variable=EMSDK_PYTHON]'/usr/bin/python3
6+
echo
7+
8+
echo Installing LLDB, QEMU
9+
sudo tdnf install -y lldb python3-lldb qemu-user
10+
echo

eng/pipelines/runtimelab/install-lldb.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

eng/pipelines/runtimelab/install-llvm.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ param(
33
[string]$CloneDir = $null,
44
[ValidateSet("Debug","Release","Checked")][string[]]$Configs = @("Debug","Release"),
55
[string]$Path = "llvm-project",
6+
[string]$Arch = $null,
67
[switch]$CI,
78
[switch]$NoClone,
89
[switch]$NoBuild
910
)
10-
1111
$ErrorActionPreference="Stop"
1212

1313
if (!(gcm git -ErrorAction SilentlyContinue))
@@ -25,6 +25,11 @@ if ($CloneDir)
2525
Set-Location -Path $CloneDir
2626
}
2727

28+
if (!$Arch)
29+
{
30+
$Arch = [Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()
31+
}
32+
2833
$LlvmProjectTag = "llvmorg-18.1.3"
2934
if ($NoClone)
3035
{
@@ -77,20 +82,20 @@ foreach ($Config in $Configs | % { if ($_ -eq "Checked") { "Debug" } else { $_ }
7782
# This logic was copied from gen-buildsys.sh. Maybe we should just call it here directly?
7883
$RepoRoot = Split-Path $PSScriptRoot | Split-Path | Split-Path
7984
# We're assuming here that the sysroot is coming from our CI docker images.
80-
$TargetArch = ($env:ROOTFS_DIR -Split '/')[-1]
8185
$TargetTriple = (Get-ChildItem $env:ROOTFS_DIR/usr/lib/gcc).Name
8286

83-
bash -c "build_arch=$TargetArch compiler=clang source $RepoRoot/eng/common/native/init-compiler.sh && set | grep -e CC -e CXX -e LDFLAGS" |
87+
bash -c "build_arch=$Arch compiler=clang source $RepoRoot/eng/common/native/init-compiler.sh && set | grep -e CC -e CXX -e LDFLAGS" |
8488
ForEach-Object {
8589
# Split the "<name>=<value>" line into the variable's name and value.
8690
$name, $value = $_ -Split '=', 2
8791
# Define it as a process-level environment variable in PowerShell.
8892
Set-Content ENV:$name $value
8993
}
90-
$env:TARGET_BUILD_ARCH = $TargetArch # Used by toolchain.cmake
94+
$env:TARGET_BUILD_ARCH = $Arch # Used by toolchain.cmake
9195
$CmakeConfigureCommandLine +=
9296
"-DCMAKE_TOOLCHAIN_FILE=$RepoRoot/eng/common/cross/toolchain.cmake",
93-
"-DLLVM_HOST_TRIPLE=$TargetTriple"
97+
"-DLLVM_HOST_TRIPLE=$TargetTriple",
98+
"-DCMAKE_ASM_COMPILER_VERSION=18.1.2" # Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/22995.
9499
}
95100

96101
Write-Host "Invoking CMake configure: 'cmake $CmakeConfigureCommandLine'"

eng/pipelines/runtimelab/install-python.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

eng/pipelines/runtimelab/runtimelab-post-build-steps.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ parameters:
33
archType: ''
44
osGroup: ''
55
osSubgroup: ''
6+
nameSuffix: ''
67
platform: ''
78
runtimeVariant: ''
89
isOfficialBuild: false
@@ -12,29 +13,33 @@ steps:
1213
# For NativeAOT-LLVM, we have just built the Wasm-targeting native artifacts (the runtime and libraries).
1314
# Now we need to build the cross-targeting compilers, RyuJit and ILC. Likewise with packages.
1415
- ${{ if eq(parameters.archType, 'wasm') }}:
15-
- script: $(Build.SourcesDirectory)/build$(scriptExt) clr.wasmjit+clr.aot -c $(buildConfigUpper) $(_officialBuildParameter) -ci -cross
16+
- script: $(Build.SourcesDirectory)/build$(scriptExt) clr.wasmjit+clr.aot -a $(hostedTargetArch) -c $(buildConfigUpper) -cross $(_officialBuildParameter) -ci
1617
displayName: Build the ILC and RyuJit cross-compilers
1718

1819
# Build target packages (note: target libs already built).
19-
- script: $(Build.SourcesDirectory)/build$(scriptExt) nativeaot.packages -a wasm -os ${{ parameters.osGroup }} -c $(buildConfigUpper) $(_officialBuildParameter) -ci
20+
- script: $(Build.SourcesDirectory)/build$(scriptExt) nativeaot.packages -os ${{ parameters.osGroup }} -a wasm -c $(buildConfigUpper) $(_officialBuildParameter) -ci
2021
displayName: Build target packages
2122

2223
# Build host packages.
23-
- script: $(Build.SourcesDirectory)/build$(scriptExt) libs+nativeaot.packages -c $(buildConfigUpper) $(_officialBuildParameter) -ci -cross
24+
- script: $(Build.SourcesDirectory)/build$(scriptExt) libs+nativeaot.packages -a $(hostedTargetArch) -c $(buildConfigUpper) -cross $(_officialBuildParameter) -ci
2425
displayName: Build host packages
2526

2627
# Build coreclr native test output outside of official build
2728
- ${{ if ne(parameters.isOfficialBuild, true) }}:
29+
- ${{ if and(eq(parameters.archType, 'wasm'), ne(parameters.nameSuffix, '')) }}:
30+
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/set-ilc-emulation-environment.ps1 -Arch $(hostedTargetArch)
31+
displayName: Set up ILC emulation environment
32+
2833
- ${{ if eq(parameters.archType, 'wasm') }}:
2934
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.osGroup }} $(crossArg) $(_officialBuildParameter) ci tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }}
30-
displayName: Build WebAssembly tests
35+
displayName: Build runtime tests
3136
- ${{ else }}:
3237
- ${{ if eq(parameters.osGroup, 'windows') }}:
3338
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }}
34-
displayName: Build tests
39+
displayName: Build runtime tests
3540
- ${{ else }}:
3641
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci 'tree nativeaot' /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }}
37-
displayName: Build tests
42+
displayName: Build runtime tests
3843

3944
- ${{ if contains(parameters.platform, 'win') }}:
4045
- script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }}
@@ -44,8 +49,7 @@ steps:
4449
displayName: Run runtime tests
4550

4651
- ${{ if eq(parameters.archType, 'wasm') }}:
47-
- script: |
48-
$(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true
52+
- script: $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true
4953
displayName: Build and run WebAssembly libraries tests
5054

5155
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/remove-duplicate-packages.ps1 -Config $(_BuildConfig) -TargetOS ${{ parameters.osGroup }} -TargetArch ${{ parameters.archType }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[CmdletBinding(PositionalBinding=$false)]
2+
param(
3+
[string]$Arch
4+
)
5+
$ErrorActionPreference="Stop"
6+
7+
if ($IsWindows)
8+
{
9+
Write-Error "Windows ILC emulation not implemented"
10+
}
11+
else
12+
{
13+
$QemuArch = $Arch -eq "arm64" ? "aarch64" : $Arch
14+
$IlcLauncher = "qemu-$QemuArch -L $env:ROOTFS_DIR"
15+
Write-Host "Setting `$(IlcLauncher) to '$IlcLauncher'"
16+
Write-Host "Setting `$(IlcHostArch) to '$Arch'"
17+
Write-Host "##vso[task.setvariable variable=IlcLauncher]$IlcLauncher"
18+
Write-Host "##vso[task.setvariable variable=IlcHostArch]$Arch"
19+
}

src/tests/nativeaot/SmokeTests/HelloWasm/PackagingTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
Test_TargetFramework=$(Test_TargetFramework);
4444
Test_RuntimeIdentifier=$(Test_RuntimeIdentifier);
4545
Test_PackageVersion=$(NetCoreAppCurrentVersion).0-*;
46+
Test_HostPackageRuntimeIdentifier=$(_portableHostOS)-$(IlcHostArch);
4647
Test_RestoreSource=$(Test_RestoreSource);
4748
Test_RestorePackagesPath=$(Test_RestorePackagesPath);
4849
</PackagingTestProjectProperties>

src/tests/nativeaot/SmokeTests/HelloWasm/PackagingTests/PackagingTestProject.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="$(Test_PackageVersion)" />
20-
<PackageReference Include="runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM" Version="$(Test_PackageVersion)" />
20+
<PackageReference Include="runtime.$(Test_HostPackageRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM" Version="$(Test_PackageVersion)" />
2121
</ItemGroup>
2222

2323
</Project>

0 commit comments

Comments
 (0)