Category="clr" />
</ItemGroup>
- <!-- Build the CoreCLR cross-arch tools when we're doing a cross-architecture build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them -->
- <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and '$(BuildArchitecture)' != '$(TargetArchitecture)'">
+ <!-- Build the CoreCLR cross tools when we're doing a cross build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them -->
+ <ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and '$(PrimaryRuntimeFlavor)' == 'CoreCLR' and '$(TargetsMobile)' != 'true') or $(_subset.Contains('+clr.crossarchtools+'))) and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)')">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler.csproj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />
<ProjectToBuild Include="$(CoreClrProjectRoot)nativeaot\BuildIntegration\BuildIntegration.proj" Category="clr" Condition="'$(NativeAotSupported)' == 'true'" />
- <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" />
+ <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)')" Include="$(CoreClrProjectRoot)tools\aot\ILCompiler\ILCompiler_crossarch.csproj" Category="clr" />
<ProjectToBuild Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" />
<ProjectToBuild Condition="'$(TargetOS)' == 'windows' or ('$(TargetOS)' == 'linux' and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')) or '$(TargetOS)' == 'osx'" Include="$(CoreClrProjectRoot)tools\SuperFileCheck\SuperFileCheck.csproj" Category="clr" />
<ItemGroup Condition="$(_subset.Contains('+clr.nativecorelib+'))">
<!-- Build crossgen2 that will be used to compile System.Private.CoreLib library for CoreCLR -->
- <ProjectToBuild Condition="'$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" />
- <ProjectToBuild Condition="!('$(TargetArchitecture)' != 'x64' and '$(BuildArchitecture)' == 'x64')" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" />
+ <ProjectToBuild Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(BuildArchitecture)' == 'x64'" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2_crossarch.csproj" Category="clr" />
+ <ProjectToBuild Condition="!(('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(BuildArchitecture)' == 'x64')" Include="$(CoreClrProjectRoot)tools\aot\crossgen2\crossgen2.csproj" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" />
</ItemGroup>
set(TOOLCHAIN "s390x-linux-gnu")
elseif(TARGET_ARCH_NAME STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64)
- if(LINUX)
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl)
+ set(TOOLCHAIN "x86_64-alpine-linux-musl")
+ elseif(LINUX)
set(TOOLCHAIN "x86_64-linux-gnu")
if(TIZEN)
set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0")
# Specify compile options
-if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU)
+if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU)
set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
<CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir>
<CoreCLRCrossgen2Dir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))</CoreCLRCrossgen2Dir>
<CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published'))</CoreCLRILCompilerDir>
- <CoreCLRCrossILCompilerDir Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir>
+ <CoreCLRCrossILCompilerDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir>
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir>
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir>
hostarch|-hostarch)
if [[ -n "$2" ]]; then
__HostArch="$2"
+ __ExplicitHostArch=1
shift
else
echo "ERROR: 'hostarch' requires a non-empty option argument"
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl OR
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/ppc64le-alpine-linux-musl OR
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl OR
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
set(ALPINE_LINUX 1)
else()
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
endif()
-elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|armv6|arm64|loongarch64|riscv64|s390x|ppc64le|x86)$" OR FREEBSD OR ILLUMOS OR TIZEN)
+elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|armv6|arm64|loongarch64|riscv64|s390x|ppc64le|x86|x64)$" OR FREEBSD OR ILLUMOS OR TIZEN)
set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
message(FATAL_ERROR "Unsupported platform. OS: ${CMAKE_SYSTEM_NAME}, arch: ${TARGET_ARCH_NAME}")
endif()
-if(TARGET_ARCH_NAME MATCHES "^(x86|s390x|armv6|loongarch64|riscv64|ppc64le)$")
+if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|riscv64|ppc64le)$")
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
<Project>
<PropertyGroup>
<NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'windows' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'x86' Or '$(TargetArchitecture)' == 'arm64')">true</NativeOptimizationDataSupported>
- <NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'linux' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'arm64')">true</NativeOptimizationDataSupported>
+ <!-- Disable PGO until we get profile data collected with a new clang -->
+ <NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'linux' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'arm64')">false</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(NoPgoOptimize)' == 'true'">false</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(Configuration)' != 'Release'">false</NativeOptimizationDataSupported>
- name: _osParameter
value: /p:RuntimeOS=linux-bionic
- # Do not rename as it clashes with MSBuild property in libraries/build-native.proj
- - name: _crossBuildPropertyArg
- value: /p:CrossBuild=${{ parameters.crossBuild }}
+ - name: crossArg
+ value: ''
+ - ${{ if eq(parameters.crossBuild, true) }}:
+ - name: crossArg
+ value: '-cross'
- ${{ if ne(parameters.jobParameters.crossrootfsDir, '') }}:
# This is only required for cross builds.
- task: CodeQL3000Init@0
displayName: Initialize CodeQL (manually-injected)
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_crossBuildPropertyArg) $(_cxx11Parameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) $(crossArg) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_cxx11Parameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
displayName: Build product
${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}:
continueOnError: ${{ parameters.shouldContinueOnError }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ crossBuild: true
${{ insert }}: ${{ parameters.jobParameters }}
# Linux musl arm
runtimeFlavor: ${{ parameters.runtimeFlavor }}
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ crossBuild: true
${{ insert }}: ${{ parameters.jobParameters }}
# Linux x86
isNonPortableSourceBuild: false
${{ insert }}: ${{ parameters.jobParameters }}
+# GCC Linux x64 Build
+
+- ${{ if containsValue(parameters.platforms, 'gcc_linux_x64') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ variables: ${{ parameters.variables }}
+ osGroup: linux
+ archType: x64
+ targetRid: linux-x64
+ platform: linux_x64
+ shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
+ container: debian-11-gcc12-amd64
+ jobParameters:
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ buildConfig: ${{ parameters.buildConfig }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ compilerName: gcc
+ ${{ insert }}: ${{ parameters.jobParameters }}
+
+# Mono Linux arm64 product build
+
+- ${{ if containsValue(parameters.platforms, 'mono_linux_arm64') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ variables: ${{ parameters.variables }}
+ osGroup: linux
+ archType: arm64
+ targetRid: linux-arm64
+ platform: linux_arm64
+ shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
+ container: mono_linux_arm64
+ jobParameters:
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ buildConfig: ${{ parameters.buildConfig }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ crossBuild: true
+ ${{ insert }}: ${{ parameters.jobParameters }}
+
+# Mono LLVMAot test build
+
+- ${{ if containsValue(parameters.platforms, 'linux_x64_llvmaot') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ variables: ${{ parameters.variables }}
+ osGroup: linux
+ archType: x64
+ targetRid: linux-x64
+ platform: linux_x64
+ shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
+ container: linux_x64_llvmaot
+ jobParameters:
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ buildConfig: ${{ parameters.buildConfig }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ ${{ insert }}: ${{ parameters.jobParameters }}
+
# Linux s390x
- ${{ if containsValue(parameters.platforms, 'linux_s390x') }}:
resources:
containers:
- container: linux_arm
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm-20230410173854-290f679
env:
ROOTFS_DIR: /crossrootfs/arm
env:
ROOTFS_DIR: /crossrootfs/armv6
- - container: linux_arm64
+ # Use old build images until we can avoid a clang-12 crash: https://github.com/dotnet/runtime/issues/84503
+ - container: mono_linux_arm64
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-cross-arm64
env:
ROOTFS_DIR: /crossrootfs/arm64
+ - container: linux_arm64
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-20230410173854-2288685
+ env:
+ ROOTFS_DIR: /crossrootfs/arm64
+
- container: linux_musl_x64
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-WithNode
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-alpine-20230410173854-2288685
+ env:
+ ROOTFS_DIR: /crossrootfs/x64
- container: linux_musl_arm
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm-alpine
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm-alpine-20230410173854-290f679
env:
ROOTFS_DIR: /crossrootfs/arm
- container: linux_musl_arm64
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm64-alpine
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine-20230410173854-2288685
env:
ROOTFS_DIR: /crossrootfs/arm64
# This container contains all required toolsets to build for Android and for Linux with bionic libc.
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-android
- container: linux_x64
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-20230410173854-2288685
+ env:
+ ROOTFS_DIR: /crossrootfs/x64
- container: linux_x86
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-x86-linux
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-x86-20230410173854-2288685
env:
ROOTFS_DIR: /crossrootfs/x86
env:
ROOTFS_DIR: /crossrootfs/ppc64le
+ - container: debian-11-gcc12-amd64
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-gcc12-amd64
+
+ - container: linux_x64_llvmaot
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7
+
- container: browser_wasm
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-webassembly-net8-20230322221728-80fdceb
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) ci ${{ parameters.archType }} $(buildConfigUpper) $(priorityArg) $(runtimeFlavorArgs) ${{ parameters.testBuildArgs }} $(runtimeVariantArg) /p:LibrariesConfiguration=${{ coalesce(parameters.liveLibrariesBuildConfig, parameters.buildConfig) }}
displayName: Build Tests
- ${{ if ne(parameters.osGroup, 'windows') }}:
- - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) ci os ${{ parameters.osGroup }} ${{ parameters.archType }} $(buildConfigUpper) $(priorityArg) $(runtimeFlavorArgs) ${{ parameters.testBuildArgs }} $(runtimeVariantArg) /p:LibrariesConfiguration=${{ coalesce(parameters.liveLibrariesBuildConfig, parameters.buildConfig) }}
+ - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(crossArg) ci os ${{ parameters.osGroup }} ${{ parameters.archType }} $(buildConfigUpper) $(priorityArg) $(runtimeFlavorArgs) ${{ parameters.testBuildArgs }} $(runtimeVariantArg) /p:LibrariesConfiguration=${{ coalesce(parameters.liveLibrariesBuildConfig, parameters.buildConfig) }}
displayName: Build Tests
runtimeVariant: ''
dependsOn: []
dependOnEvaluatePaths: false
+ crossBuild: false
pgoType: ''
### Build managed test components (native components are getting built as part
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
+ crossBuild: ${{ parameters.crossBuild }}
container: ${{ parameters.container }}
runtimeVariant: ${{ parameters.runtimeVariant }}
testGroup: ${{ parameters.testGroup }}
pool: ${{ parameters.pool }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
-
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc'), not(and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '_musl'))), not(eq(parameters.osGroup, 'osx'))) }}:
- compilerArg: '-clang9'
- ${{ if not(and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc'), not(and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '_musl'))), not(eq(parameters.osGroup, 'osx')))) }}:
- compilerArg: ''
+ compilerArg: ''
# Test jobs should continue on error for internal builds
${{ if eq(variables['System.TeamProject'], 'internal') }}:
value: 'libs.sfx+libs.oob+clr.iltools /p:RefOnly=true -c Release -ci'
- name: compilerArg
value: ''
- - ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc')) }}:
- - name: compilerArg
- value: '-clang9'
- # We need to use the stable version available on Alpine Linux
- - ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '_musl')) }}:
- - name: compilerArg
- value: ''
- # AppleClang has different version scheme, so we let compiler introspection pick up the available clang from PATH
- - ${{ if eq(parameters.osGroup, 'osx') }}:
- - name: compilerArg
- value: ''
- name: runtimeFlavorArgs
value: ''
displayName: Install native dependencies
# Build core/libraries dependencies of test build
- - script: $(Build.SourcesDirectory)/build$(scriptExt) $(liveRuntimeBuildParams) $(compilerArg)
+ - script: $(Build.SourcesDirectory)/build$(scriptExt) $(liveRuntimeBuildParams) $(crossArg) $(compilerArg)
displayName: Build coreclr/libs components needed by test build
- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos') }}:
# Publishing tooling doesn't support different configs between runtime and libs, so only run tests in Release config
- ${{ if eq(parameters.buildConfig, 'release') }}:
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) -s libs.tests -c $(_BuildConfig) /p:TestAssemblies=false /p:RunNativeAotTestApps=true $(_officialBuildParameter) $(_crossBuildPropertyArg) /bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfigUpper)/NativeAotTests.binlog ${{ parameters.extraTestArgs }}
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) -s libs.tests -c $(_BuildConfig) $(crossArg) /p:TestAssemblies=false /p:RunNativeAotTestApps=true $(_officialBuildParameter) /bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfigUpper)/NativeAotTests.binlog ${{ parameters.extraTestArgs }}
displayName: Run NativeAot Library Tests
- name: compilerArg
value: ''
- - ${{ if ne(parameters.osGroup, 'windows') }}:
- - name: compilerArg
- value: '-clang9'
- # We need to use the stable version available on Alpine Linux
- - ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '_musl')) }}:
- - name: compilerArg
- value: ''
- # AppleClang has different version scheme, so we let compiler introspection pick up the available clang from PATH
- - ${{ if eq(parameters.osGroup, 'osx') }}:
- - name: compilerArg
- value: ''
- ${{ if eq(parameters.osGroup, 'windows') }}:
- name: PythonScript
value: '-gcc'
- name: publishLogsArtifactPrefix
value: 'BuildLogs_CoreCLR_GCC'
- - ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc')) }}:
- - name: compilerArg
- value: '-clang9'
- # We need to use the stable version available on Alpine Linux
- - ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubgroup, '_musl')) }}:
- - name: compilerArg
- value: ''
- # AppleClang has different version scheme, so we let compiler introspection pick up the available clang from PATH
- - ${{ if eq(parameters.osGroup, 'osx') }}:
- - name: compilerArg
- value: ''
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
# Variables used to publish packages to blob feed
- name: dotnetfeedUrl
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(CoreClrPgoDataArg)
displayName: Build CoreCLR Runtime
- - ${{ if ne(parameters.archType, 'x64') }}:
+ - ${{ if or(eq(parameters.crossBuild, 'true'), ne(parameters.archType, 'x64')) }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch x64 $(osArg) -ci $(compilerArg) -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" $(officialBuildIdArg) $(clrRuntimePortableBuildArg)
displayName: Build CoreCLR Cross-Arch Tools (Tools that run on x64 targeting x86)
# Build CoreCLR Managed Components
- ${{ if or(ne(parameters.osGroup, 'linux'), ne(parameters.archType, 'x86')) }}:
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.nativeaotlibs+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.nativeaotlibs+clr.tools+clr.packages+clr.paltestlist $(crossArg) $(compilerArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
- ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.archType, 'x86')) }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
steps:
# Execute tests
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) -s libs.tests -c $(_BuildConfig) /p:TestAssemblies=false /p:TestTrimming=true $(_officialBuildParameter) $(_crossBuildPropertyArg) /bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfigUpper)/TrimmingTests.binlog ${{ parameters.extraTestArgs }}
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) -s libs.tests -c $(_BuildConfig) $(crossArg) /p:TestAssemblies=false /p:TestTrimming=true $(_officialBuildParameter) /bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfigUpper)/TrimmingTests.binlog ${{ parameters.extraTestArgs }}
displayName: Run Trimming Tests
# Build
- ${{ if ne(parameters.osGroup, 'windows') }}:
- - script: ./build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) $(darwinFrameworks)
+ - script: ./build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts $(crossArg) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) $(darwinFrameworks)
displayName: Build product
- ${{ if eq(parameters.osGroup, 'windows') }}:
- script: build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter)
# Build packages
- ${{ if ne(parameters.osGroup, 'windows') }}:
- - script: ./build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) -pack $(OutputRidArg)
+ - script: ./build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts $(crossArg) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) -pack $(OutputRidArg)
displayName: Build nupkg
- ${{ if eq(parameters.osGroup, 'windows') }}:
- script: build$(scriptExt) -subset mono$(msCorDbi)+clr.hosts -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) -pack $(OutputRidArg)
name: ''
helixType: '(unspecified)'
container: ''
+ crossBuild: false
liveLibrariesBuildConfig: ''
strategy: ''
pool: ''
name: ${{ parameters.name }}
helixType: ${{ parameters.helixType }}
container: ${{ parameters.container }}
+ crossBuild: ${{ parameters.crossBuild }}
strategy: ${{ parameters.strategy }}
pool: ${{ parameters.pool }}
runtimeVariant: ${{ parameters.runtimeVariant }}
jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
buildConfig: checked
platforms:
- - linux_x64
- container: debian-11-gcc12-amd64
+ - gcc_linux_x64
jobParameters:
testGroup: innerloop
- compilerName: gcc
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
- osx_x64
- osx_arm64
- linux_x64
- - linux_arm64
+ # - linux_arm64
+ # Remove once we can use linux_arm64: https://github.com/dotnet/runtime/issues/84503
+ - mono_linux_arm64
# - linux_musl_arm64
- windows_x64
- windows_x86
buildConfig: Release
runtimeFlavor: mono
platforms:
- - linux_x64
+ - linux_x64_llvmaot
# Disabled pending outcome of https://github.com/dotnet/runtime/issues/60234 investigation
#- linux_arm64
variables:
<IlcSdkPath>{IlcSdkPath}</IlcSdkPath>
<IlcFrameworkPath>{IlcFrameworkPath}</IlcFrameworkPath>
<IlcFrameworkNativePath>{IlcFrameworkNativePath}</IlcFrameworkNativePath>
+ <LinkerFlavor Condition="'$(TargetOS)' == 'linux'">lld</LinkerFlavor>
+ <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<CoreCLRBuildIntegrationDir>{CoreCLRBuildIntegrationDir}</CoreCLRBuildIntegrationDir>
</PropertyGroup>
<ItemGroup>
+ <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
+ </ItemGroup>
+
+ <ItemGroup>
{RuntimeHostConfigurationOptions}
</ItemGroup>
<PropertyGroup Condition="'$(TestNativeAot)' == 'true'">
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
- <SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
+ <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
<IlcFrameworkPath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkPath>
<IlcFrameworkNativePath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkNativePath>
+ <LinkerFlavor Condition="'$(TargetOS)' == 'linux'">lld</LinkerFlavor>
<NoWarn>$(NoWarn);IL1005;IL2105;IL3000;IL3001;IL3002;IL3003</NoWarn>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
endif()
endif()
+ if(CLR_CMAKE_TARGET_LINUX AND CLR_CMAKE_TARGET_ARCH_I386)
+ add_linker_flag(-Wl,-z,notext)
+ endif()
+
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(pal)
add_subdirectory(hosts)
export __IntermediatesDir __ArtifactsIntermediatesDir
-if [[ "$__TargetArch" != "$__HostArch" ]]; then
+if [[ "$__ExplicitHostArch" == 1 ]]; then
__IntermediatesDir="$__IntermediatesDir/$__HostArch"
__BinDir="$__BinDir/$__HostArch"
fi
<PropertyGroup>
<CrossDir></CrossDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(BuildArchitecture)' != '$(TargetArchitecture)'">
- <CrossDir Condition="'$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'armel'">x64</CrossDir>
- <CrossDir Condition="'$(TargetArchitecture)' == 'x86'">$(BuildArchitecture)</CrossDir>
- </PropertyGroup>
+ <CrossDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$(BuildArchitecture)</CrossDir>
- <PropertyGroup>
<BuildDll>true</BuildDll>
- <BuildDll Condition="'$(CrossBuild)' == 'true' and '$(CrossDir)' == ''">false</BuildDll>
<BuildPdb>false</BuildPdb>
<BuildPdb Condition="$(BuildDll) and '$(OS)' == 'Windows_NT' and '$(TargetOS)' == 'windows'">true</BuildPdb>
</ItemGroup>
<ItemGroup Condition="'$(_targetOS)' != 'win' and '$(_IsApplePlatform)' != 'true'">
<CustomLinkerArg Include="-Wl,--discard-all" />
- <CustomLinkerArg Include="-Wl,--gc-sections" Condition="'$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd' or '$(LinkerFlavor)' == 'lld'" />
- <CustomLinkerArg Include="-Wl,-T,"$(NativeIntermediateOutputPath)sections.ld"" Condition="'$(LinkerFlavor)' == 'lld'" />
+ <CustomLinkerArg Include="-Wl,--gc-sections" Condition="'$(LinkerFlavor)' == '' or '$(LinkerFlavor)' == 'bfd'" />
</ItemGroup>
<ItemGroup>
<CustomLibArg Include="-crs "$(NativeBinary)"" Condition="'$(_targetOS)' != 'win'" />
<StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'">-x</StripFlag> <!-- keep global symbols in dylib -->
</PropertyGroup>
- <!-- write linker script for lld to retain the __modules section -->
- <WriteLinesToFile File="$(NativeIntermediateOutputPath)sections.ld" Lines="OVERWRITE_SECTIONS { __modules : { KEEP(*(__modules)) } }" Overwrite="true" Condition="'$(LinkerFlavor)' == 'lld'" />
-
<Exec Command=""$(CppLinker)" @(CustomLinkerArg, ' ')" Condition="'$(_targetOS)' != 'win' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" />
<Exec Command=""$(CppLibCreator)" @(CustomLibArg, ' ')" Condition="'$(_targetOS)' != 'win' and '$(NativeLib)' == 'Static'" />
# Function required to give CMAKE_REQUIRED_* local scope
function(check_have_lto)
set(CMAKE_REQUIRED_FLAGS -flto)
- set(CMAKE_REQUIRED_LIBRARIES -flto -fuse-ld=gold)
+ set(CMAKE_REQUIRED_LIBRARIES -flto)
check_cxx_source_compiles("int main() { return 0; }" HAVE_LTO)
endfunction(check_have_lto)
check_have_lto()
<NativeAotSupported Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'linux' and '$(TargetOS)' != 'osx'">false</NativeAotSupported>
<NativeAotSupported Condition="'$(TargetArchitecture)' != 'x64'">false</NativeAotSupported>
<PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot>
+ <SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<PublishReadyToRun Condition="'$(NativeAotSupported)' != 'true'">true</PublishReadyToRun>
<PublishSingleFile Condition="'$(NativeAotSupported)' != 'true'">true</PublishSingleFile>
<PublishTrimmed Condition="'$(NativeAotSupported)' != 'true'">true</PublishTrimmed>
</PropertyGroup>
+ <!-- TODO: remove this once we pick up an SDK with https://github.com/dotnet/runtime/pull/82645.
+ This works around an incorrect ILC host package name when targeting linux-musl-x64 from linux-x64. -->
+ <Target Name="_FixIlcHostArch"
+ BeforeTargets="ImportRuntimeIlcPackageTarget">
+ <PropertyGroup>
+ <_hostOS>$(NETCoreSdkPortableRuntimeIdentifier.SubString(0, $(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))))</_hostOS>
+ <OSIdentifier>$(_hostOS)</OSIdentifier>
+ <IlcHostPackageName>runtime.$(OSIdentifier)-$(IlcHostArch).Microsoft.DotNet.ILCompiler</IlcHostPackageName>
+ </PropertyGroup>
+ </Target>
+
+ <!-- Needed for the amd64 -> amd64 musl cross-build to pass the target flag. -->
+ <Target Name="_FixIlcTargetTriple"
+ AfterTargets="SetupOSSpecificProps"
+ Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">
+ <!-- Compute CrossCompileRid, and copy the downstream logic as-is. -->
+ <PropertyGroup>
+ <CrossCompileRid>$(RuntimeIdentifier)</CrossCompileRid>
+
+ <CrossCompileArch />
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' != 'true'">aarch64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' == 'true'">arm64</CrossCompileArch>
+
+ <TargetTriple />
+ <TargetTriple Condition="'$(CrossCompileArch)' != ''">$(CrossCompileArch)-linux-gnu</TargetTriple>
+ <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('linux-musl')) or $(CrossCompileRid.StartsWith('alpine')))">$(CrossCompileArch)-alpine-linux-musl</TargetTriple>
+ <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('freebsd')))">$(CrossCompileArch)-unknown-freebsd12</TargetTriple>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'osx' and '$(TargetTriple)' != ''" />
+ </ItemGroup>
+ </Target>
+
+<Target Name="LocateNativeCompiler"
+ Condition="'$(NativeAotSupported)' == 'true' and '$(HostOS)' != 'windows'"
+ BeforeTargets="SetupOSSpecificProps">
+ <PropertyGroup>
+ <CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
+ <!-- TODO: change to <LinkerFlavor>lld</LinkerFlavor> once we pick up an SDK with https://github.com/dotnet/runtime/pull/83558. -->
+ <UseLLVMLinker Condition="'$(CppCompilerAndLinker)' == 'clang' and '$(TargetOS)' == 'linux'">true</UseLLVMLinker>
+ </PropertyGroup>
+
+ <Exec Command="sh -c 'build_arch="$(TargetArchitecture)" compiler="$(CppCompilerAndLinker)" . "$(RepositoryEngineeringDir)/common/native/init-compiler.sh" && echo $CC' 2>/dev/null"
+ EchoOff="true"
+ ConsoleToMsBuild="true"
+ StandardOutputImportance="Low">
+ <Output TaskParameter="ConsoleOutput" PropertyName="CppLinker" />
+ </Exec>
+ </Target>
+
+ <ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
+ <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(IlcHostArch)' == '$(TargetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
+ </ItemGroup>
+
<Target Name="PublishCompiler"
Condition="'$(BuildingInsideVisualStudio)' != 'true'"
AfterTargets="Build"
<PropertyGroup Condition="'$(NativeAotSupported)' == 'true'">
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
- <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
- <SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
+ <IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
+ <SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</IlcFrameworkPath>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
</PropertyGroup>
+ <ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
+ <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
+ </ItemGroup>
+
<Import Project="$(R2ROverridePath)" Condition="'$(R2ROverridePath)' != ''" />
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets"
Condition="'$(NativeAotSupported)' == 'true' and '$(_IsPublishing)' == 'true'" />
</ItemGroup>
</Target>
+ <!-- Needed for the amd64 -> amd64 musl cross-build to pass the target flag. -->
+ <Target Name="_FixIlcTargetTriple"
+ AfterTargets="SetupOSSpecificProps"
+ Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">
+ <!-- Compute CrossCompileRid, and copy the downstream logic as-is. -->
+ <PropertyGroup>
+ <CrossCompileRid>$(RuntimeIdentifier)</CrossCompileRid>
+
+ <CrossCompileArch />
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' != 'true'">aarch64</CrossCompileArch>
+ <CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(_IsApplePlatform)' == 'true'">arm64</CrossCompileArch>
+
+ <TargetTriple />
+ <TargetTriple Condition="'$(CrossCompileArch)' != ''">$(CrossCompileArch)-linux-gnu</TargetTriple>
+ <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('linux-musl')) or $(CrossCompileRid.StartsWith('alpine')))">$(CrossCompileArch)-alpine-linux-musl</TargetTriple>
+ <TargetTriple Condition="'$(CrossCompileArch)' != '' and ($(CrossCompileRid.StartsWith('freebsd')))">$(CrossCompileArch)-unknown-freebsd12</TargetTriple>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'osx' and '$(TargetTriple)' != ''" />
+ </ItemGroup>
+ </Target>
+
<Target Name="LocateNativeCompiler"
Condition="'$(NativeAotSupported)' == 'true' and '$(_IsPublishing)' == 'true' and '$(HostOS)' != 'windows'"
BeforeTargets="SetupOSSpecificProps">
<PropertyGroup>
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
+ <LinkerFlavor Condition="'$(CppCompilerAndLinker)' == 'clang' and '$(TargetOS)' == 'linux'">lld</LinkerFlavor>
</PropertyGroup>
<Exec Command="sh -c 'build_arch="$(TargetArchitecture)" compiler="$(CppCompilerAndLinker)" . "$(RepositoryEngineeringDir)/common/native/init-compiler.sh" && echo $CC' 2>/dev/null"
<PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion>
<!-- Publishing as single-file or NativeAOT means we can't examine the interior DLLs -->
<ShouldVerifyClosure>false</ShouldVerifyClosure>
- <!-- Publish crossgen2 as a single-file app on cross-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
+ <!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
<!-- Can't use NativeAOT in source build yet https://github.com/dotnet/runtime/issues/66859 -->
<NativeAotSupported Condition="'$(DotNetBuildFromSource)' == 'true'">false</NativeAotSupported>
- <ObjCopyName Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(CrossBuild)' == 'true' and '$(RuntimeIdentifier)' == 'linux-musl-arm64'">llvm-objcopy-15</ObjCopyName>
- <ObjCopyName Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(CrossBuild)' == 'true' and '$(RuntimeIdentifier)' == 'linux-arm64'">aarch64-linux-gnu-objcopy</ObjCopyName>
</PropertyGroup>
<Target Name="PublishCrossgen"
</Target>
<Target Name="RunPublishedCrossgen" AfterTargets="PublishCrossgen"
- Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)'">
+ Condition="'$(TargetOS)' == '$(HostOS)' and '$(TargetArchitecture)' == '$(BuildArchitecture)' and '$(CrossBuild)' != 'true'">
<!-- Run the published crossgen if we're not cross-compiling -->
<Exec Command="@(FilesToPackage) $(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll --out $(IntermediateOutputPath)S.P.C.tmp" Condition="'%(FileName)%(Extension)' == 'crossgen2$(ExeSuffix)'">
<Output TaskParameter="ExitCode" PropertyName="CrossgenExitCode" />
<!-- The following property group can be simplified once runtime repo switches over to SDK 6.0 drop -->
<PropertyGroup>
<CrossDir />
- <CrossDir Condition="'$(BuildArchitecture)' != '$(TargetArchitecture)'">x64</CrossDir>
+ <CrossDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$(BuildArchitecture)</CrossDir>
<Crossgen2Dll>$(CoreCLRArtifactsPath)\$(CrossDir)\crossgen2\crossgen2.dll</Crossgen2Dll>
<PublishReadyToRunUseCrossgen2>true</PublishReadyToRunUseCrossgen2>
elseif(HOST_LINUX)
include(FindPkgConfig)
if(CROSS_ROOTFS)
- set(ENV{PKG_CONFIG_ICU_UC_INCLUDEDIR} "${CROSS_ROOTFS}/usr/include")
+ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${CROSS_ROOTFS}")
endif(CROSS_ROOTFS)
pkg_check_modules(ICU icu-uc)
set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations")
<Error Condition="'$(HostOS)' == 'windows' and ('$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Text="Error: Mono runtime for $(TargetOS) can't be built on Windows." />
<!-- check if Ninja is available and default to it on Unix platforms -->
- <Exec Condition="'$(HostOS)' != 'windows' and '$(Ninja)' == ''" Command="which ninja" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" StandardOutputImportance="Low" >
+ <Exec Condition="'$(HostOS)' != 'windows' and '$(Ninja)' == ''" Command="command -v ninja" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" StandardOutputImportance="Low" >
<Output TaskParameter="ExitCode" PropertyName="_MonoFindNinjaExitCode"/>
</Exec>
<PropertyGroup>
<_MonoBuildEnv Include="PKG_CONFIG_PATH=$(MonoCrossDir)/lib/pkgconfig" />
</ItemGroup>
+ <!-- x64 linux cross build options -->
+ <ItemGroup Condition="'$(TargetsLinux)' == 'true' and '$(MonoCrossDir)' != '' and '$(TargetArchitecture)' == 'x64'">
+ <_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" />
+ <_MonoBuildEnv Include="TARGET_BUILD_ARCH=x64" />
+ <_MonoBuildEnv Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/pkgconfig" />
+ </ItemGroup>
+
+ <!-- x86 linux cross build options -->
+ <ItemGroup Condition="'$(TargetsLinux)' == 'true' and '$(MonoCrossDir)' != '' and '$(TargetArchitecture)' == 'x86'">
+ <_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" />
+ <_MonoBuildEnv Include="TARGET_BUILD_ARCH=x86" />
+ <_MonoBuildEnv Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/pkgconfig" />
+ </ItemGroup>
+
<!-- riscv64 Linux cross build options -->
<ItemGroup Condition="'$(MonoCrossDir)' != '' and '$(TargetArchitecture)' == 'riscv64'">
<_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" />
<!-- Linux options -->
<ItemGroup Condition="'$(TargetsLinux)' == true">
<_MonoCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
<_MonoCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
</ItemGroup>
<ItemGroup Condition="'$(RealTargetOS)' == 'linux'">
<_MonoAOTCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCFLAGS Condition="'$(RealTargetArchitecture)' == 'arm'" Include="-march=armv7-a" />
<_MonoAOTCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCXXFLAGS Condition="'$(RealTargetArchitecture)' == 'arm'" Include="-march=armv7-a" />
</ItemGroup>
<!-- Devloop features -->
<_ObjcopyPrefix Condition="'$(MonoCrossDir)' != '' and '$(Platform)' == 'riscv64' and $(_Objcopy) == ''">llvm-objcopy-</_ObjcopyPrefix>
</PropertyGroup>
<!-- test viability of objcopy command -->
- <Exec Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true')" Command="$(_Objcopy) -V" IgnoreStandardErrorWarningFormat="true" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" EchoOff="true" ConsoleToMsBuild="true">
+ <Exec Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true')" Command="llvm-objcopy -V" IgnoreStandardErrorWarningFormat="true" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" EchoOff="true" ConsoleToMsBuild="true">
+ <Output TaskParameter="ExitCode" PropertyName="_ObjcopyFound"/>
+ </Exec>
+ <PropertyGroup>
+ <_Objcopy Condition="'$(_ObjcopyFound)' == '0'">llvm-objcopy</_Objcopy>
+ </PropertyGroup>
+ <Exec Condition="'$(_ObjcopyFound)' != '0' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true')" Command="$(_Objcopy) -V" IgnoreStandardErrorWarningFormat="true" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" EchoOff="true" ConsoleToMsBuild="true">
<Output TaskParameter="ExitCode" PropertyName="_ObjcopyFound"/>
</Exec>
<Exec Condition="'$(_ObjcopyPrefix)' != ''" Command="find /usr/bin -name $(_ObjcopyPrefix)* | sort -V | tail -1" IgnoreStandardErrorWarningFormat="true" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" EchoOff="true" ConsoleToMsBuild="true">
<MonoAotCrossOffsetsToolParams Condition="'$(TargetsWasi)' == 'true'" Include="--wasi-sdk="$([MSBuild]::NormalizePath('$(WASI_SDK_PATH)'))"" />
</ItemGroup>
+ <!-- x64 Linux cross build options -->
+ <ItemGroup Condition="'$(RealTargetArchitecture)' == 'x64' and '$(RealTargetOS)' == 'linux'">
+ <MonoAOTCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" />
+ <_MonoAotBuildEnv Include="TARGET_BUILD_ARCH=x64" />
+ <_MonoAotBuildEnv Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/x86_64-linux-gnu/pkgconfig" />
+ </ItemGroup>
+
<!-- ARM Linux cross build options on CI -->
<ItemGroup Condition="'$(RealTargetArchitecture)' == 'arm64' and '$(RealTargetOS)' == 'linux'">
<MonoAOTCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$(CrossToolchainFile)" />
<PropertyGroup>
<_MonoSkipInitCompiler Condition="'$(RealTargetArchitecture)' != '' and '$(RealTargetArchitecture)' != '$(BuildArchitecture)'">false</_MonoSkipInitCompiler>
+ <_MonoSkipInitCompiler Condition="'$(CrossBuild)' == 'true'">false</_MonoSkipInitCompiler>
<_MonoAotCrossOffsetsCommand Condition="'$(MonoUseCrossTool)' == 'true'">$(PythonCmd) $(MonoProjectRoot)mono/tools/offsets-tool/offsets-tool.py @(MonoAotCrossOffsetsToolParams, ' ')</_MonoAotCrossOffsetsCommand>
<_MonoAotCMakeConfigureCommand>cmake @(MonoAOTCMakeArgs, ' ') $(MonoCMakeExtraArgs) "$(MonoProjectRoot.TrimEnd('\/'))"</_MonoAotCMakeConfigureCommand>
<_MonoAotCMakeConfigureCommand Condition="'$(_MonoSkipInitCompiler)' != 'true' and '$(HostOS)' != 'windows'">sh -c 'build_arch="$(_CompilerTargetArch)" compiler="$(MonoCCompiler)" . "$(RepositoryEngineeringCommonDir)native/init-compiler.sh" && @(_MonoAotBuildEnv, ' ') $(_MonoAotCMakeConfigureCommand)'</_MonoAotCMakeConfigureCommand>
install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs)
-if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ANDROID)
+if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_ALPINE_LINUX)
if (GEN_SHARED_LIB)
add_custom_command(TARGET System.Globalization.Native POST_BUILD
COMMENT "Verifying System.Globalization.Native.so dependencies"
if (GEN_SHARED_LIB)
if (FEATURE_DISTRO_AGNOSTIC_SSL)
- # on macOS the link step fails with undefined symbols, and the script doesn't run.
+ # on macOS and Alpine the link step fails with undefined symbols, and the script doesn't run.
# if the build succeeds, the script would succeed, except it uses a Linux-only command.
#
# on Linux, the build will succeed with undefined symbols, then the script reports them
# and fails the build for us.
- if (NOT APPLE)
+ if (NOT APPLE AND NOT CLR_CMAKE_TARGET_ALPINE_LINUX)
add_custom_command(TARGET System.Security.Cryptography.Native.OpenSsl POST_BUILD
COMMENT "Verifying System.Security.Cryptography.Native.OpenSsl.so dependencies"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath>
<RuntimeIdentifier>$(OutputRid)</RuntimeIdentifier>
+ <LinkerFlavor Condition="'$(TargetOS)' == 'linux'">lld</LinkerFlavor>
+ <SysRoot Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
<BuildNativeAotFrameworkObjects Condition="'$(IlcMultiModule)' == 'true'">true</BuildNativeAotFrameworkObjects>
<DisableFrameworkLibGeneration Condition="'$(BuildNativeAotFrameworkObjects)' == 'true'">true</DisableFrameworkLibGeneration>
<FrameworkLibPath Condition="'$(BuildNativeAotFrameworkObjects)' == 'true'">$(IlcSdkPath)</FrameworkLibPath>
</PropertyGroup>
<ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
+ <CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
<IlcReference Include="$(TargetingPackPath)/*.dll" />
<!-- xunit calls MakeGenericType to check if something is IEquatable -->
<GroupBuildCmd>$(GroupBuildCmd) /nodeReuse:false</GroupBuildCmd>
<GroupBuildCmd>$(GroupBuildCmd) /maxcpucount</GroupBuildCmd>
<GroupBuildCmd>$(GroupBuildCmd) /bl:$(ArtifactsDir)/log/$(Configuration)/InnerManagedTestBuild.$(__TestGroupToBuild).binlog</GroupBuildCmd>
+ <GroupBuildCmd Condition="'$(CrossBuild)' == 'true'">$(GroupBuildCmd) "/p:CrossBuild=true"</GroupBuildCmd>
<GroupBuildCmd Condition="'$(TestBuildMode)' == 'nativeaot'">$(GroupBuildCmd) "/p:DefaultBuildAllTarget=BuildNativeAot"</GroupBuildCmd>
<GroupBuildCmd Condition="'$(IlcMultiModule)' == 'true'">$(GroupBuildCmd) "/p:IlcMultiModule=true"</GroupBuildCmd>
<GroupBuildCmd Condition="'$(BuildNativeAotFrameworkObjects)' == 'true'">$(GroupBuildCmd) "/p:BuildNativeAotFrameworkObjects=true"</GroupBuildCmd>
// Just count the number of warnings and errors. There are so many right now that it's not worth enumerating the list
#if DEBUG
- const int MinWarnings = 17000;
+ const int MinWarnings = 16500;
const int MaxWarnings = 18500;
#else
- const int MinWarnings = 12000;
- const int MaxWarnings = 13000;
+ const int MinWarnings = 9500;
+ const int MaxWarnings = 10500;
#endif
int count = 0;
string line;
else
{
lowerBound = 1300 * 1024; // ~1.3 MB
- upperBound = 1600 * 1024; // ~1.6 MB
+ upperBound = 1750 * 1024; // ~1.75 MB
}
if (fileSize < lowerBound || fileSize > upperBound)
{
- Console.WriteLine("BUG: File size is not in the expected range. Did a libraries change regress size of Hello World?");
+ Console.WriteLine($"BUG: File size is not in the expected range ({lowerBound} to {upperBound} bytes). Did a libraries change regress size of Hello World?");
return 1;
}
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);BASELINE_INTRINSICS</DefineConstants>
<StripSymbols>true</StripSymbols>
-
- <!-- We should be able to delete once CI machines no longer use ancient LLVM -->
- <ObjCopyName>objcopy</ObjCopyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);NON_VEX_INTRINSICS</DefineConstants>
<StripSymbols>true</StripSymbols>
-
- <!-- We should be able to delete once CI machines no longer use ancient LLVM -->
- <ObjCopyName>objcopy</ObjCopyName>
</PropertyGroup>
<ItemGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);VEX_INTRINSICS</DefineConstants>
<StripSymbols>true</StripSymbols>
-
- <!-- We should be able to delete once CI machines no longer use ancient LLVM -->
- <ObjCopyName>objcopy</ObjCopyName>
</PropertyGroup>
<ItemGroup>