Skip to content
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

WIP: Build CoreCLR for Mac Catalyst OS #51000

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4981587
Initial support for compiling clr runtime subset against maccatalyst
directhex Mar 31, 2021
b697a83
Fix build on x64
directhex Mar 31, 2021
bd073e5
Merge remote-tracking branch 'origin/main' into maccatalyst-coreclr
directhex Apr 21, 2021
dd65b4e
Allow 'clr' subset to work for Mac Catalyst
directhex Apr 21, 2021
9a0b667
Re-order, so single file host builds after -DTARGET_MACCATALYST is im…
directhex Apr 21, 2021
c813a32
Don't build/depend on Mono corelib
directhex Apr 21, 2021
914c0e6
Better handling of runtimeflavor
directhex Apr 21, 2021
5de69c2
Fix
directhex Apr 21, 2021
397849d
Don't do XplatEventSource on Catalyst
directhex Apr 21, 2021
3694620
Add System.Globalization.Native to build. Removes need for invariant …
directhex Apr 22, 2021
eeba7e6
Allow AppleTestRunner.dll to run on non-mono w/ CoreRun
directhex Apr 22, 2021
28c754b
Add more native libs to the build
directhex Apr 22, 2021
593b42b
Allow AppleAppBuilder to build a CoreCLR Catalyst app
directhex Apr 23, 2021
58e470a
Fix up coreclr runtime template
directhex Apr 26, 2021
a3970e1
Add CoreCLR Catalyst x64 to runtime-staging
directhex Apr 26, 2021
9cc3afc
Merge remote-tracking branch 'origin/main' into maccatalyst-coreclr
directhex Apr 26, 2021
51d2c76
Don't only run Catalyst on FullMatrix
directhex Apr 26, 2021
189422a
Don't hardcode Mono RuntimeFlavor on Catalyst
directhex Apr 26, 2021
5432b12
Treat Catalyst like OSX in AzDO
directhex Apr 26, 2021
52c17ac
Add Catalyst to eng/install-native-dependencies.sh
directhex Apr 26, 2021
a996d91
CoreCLR bypasses build.sh, ensure we pass an OS to build-runtime.sh
directhex Apr 26, 2021
d47bc74
Try passing osArg into native test component build
directhex Apr 26, 2021
80730bf
Don't try to build stuff we aren't targeting on MacCatalyst
directhex Apr 26, 2021
8f25396
Force Flavor to be specified, as we use it for coreclr vs mono Catalyst
directhex Apr 26, 2021
c3433be
Ensure coreclrhost.h is bundled into artifacts folder
directhex Apr 27, 2021
cf6529d
Try to get include folder into mobile runtime pack on mobile
directhex Apr 27, 2021
a03399d
Only build system.buffers.tests for now, to avoid disk full noise in CI
directhex Apr 27, 2021
1d3f34e
Don't exclude libcoreclr.dylib from Resources/
directhex Apr 27, 2021
9958dcf
Fix up coreclr vs mono headers path
directhex Apr 27, 2021
fd9844f
Required Catalyst Helix changes from #51139
directhex Apr 27, 2021
9a0ec57
Typo
directhex Apr 27, 2021
153de52
Fix on ios, clean up unused ObjC code
directhex Apr 27, 2021
0f3ed14
Revert "Only build system.buffers.tests for now, to avoid disk full n…
directhex Apr 27, 2021
e66fefd
Merge remote-tracking branch 'origin/main' into maccatalyst-coreclr
directhex Apr 27, 2021
4c7d848
Skip .dwarf files on Mobile targets, TOO CHONKY
directhex Apr 27, 2021
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
5 changes: 3 additions & 2 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
<PropertyGroup>
<RuntimeFlavor Condition="'$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">CoreCLR</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' or ((!$(_subset.Contains('+mono+')) and !$(_subset.Contains('+mono.runtime+'))) and ($(_subset.Contains('+clr+')) or $(_subset.Contains('+clr.runtime+'))))">CoreCLR</RuntimeFlavor>
</PropertyGroup>

<PropertyGroup>
<DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets>clr.native+clr.corelib</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets Condition="'$(TargetOS)' != 'MacCatalyst'">$(DefaultCoreClrSubsets)+linuxdac+clr.tools+clr.nativecorelib+clr.packages</DefaultCoreClrSubsets>

<DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
<DefaultMonoSubsets Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(MonoAOTLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
Expand Down
4 changes: 2 additions & 2 deletions eng/install-native-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ "$1" = "Linux" ]; then
if [ "$?" != "0" ]; then
exit 1;
fi
elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then
elif [ "$1" = "OSX" ] || [ "$1" = "MacCatalyst" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then
engdir=$(dirname "${BASH_SOURCE[0]}")

if [ "$3" = "azDO" ]; then
Expand All @@ -47,7 +47,7 @@ elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then
exit 1;
fi
else
echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument."
echo "Must pass \"Linux\", \"tvOS\", \"iOS\", \"MacCatalyst\" or \"OSX\" as first argument."
exit 1
fi

8 changes: 6 additions & 2 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
<RuntimeFiles
Include="
$(CoreCLRSharedFrameworkPdbDir)*.pdb;
$(CoreCLRSharedFrameworkPdbDir)*.dbg;
$(CoreCLRSharedFrameworkPdbDir)*.dbg" IsNative="true" />
<RuntimeFiles Condition="'$(TargetsMobile)' != 'true'"
Include="
$(CoreCLRSharedFrameworkPdbDir)*.dwarf" IsNative="true" />
<RuntimeFiles
Include="$(CoreCLRArtifactsPdbDir)System.Private.CoreLib.pdb" />
Expand All @@ -102,6 +104,8 @@
<TargetPath>runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native</TargetPath>
<IsNative>true</IsNative>
</CoreCLRCrossTargetFiles>
<RuntimeIncludeFiles Condition="'$(TargetsMobile)' == 'true'"
Include="$(CoreCLRArtifactsPath)\inc\**\*.*" />
</ItemGroup>
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
<RuntimeFiles Include="$(MonoArtifactsPath)\*.*" />
Expand All @@ -111,7 +115,7 @@

<MonoCrossFiles Condition="'$(TargetsMobile)' == 'true'"
Include="$(MonoArtifactsPath)\cross\**\*.*" />
<MonoIncludeFiles Condition="'$(TargetsMobile)' == 'true'"
<RuntimeIncludeFiles Condition="'$(TargetsMobile)' == 'true'"
Include="$(MonoArtifactsPath)\include\**\*.*" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ jobs:
targetRid: maccatalyst-x64
platform: MacCatalyst_x64
jobParameters:
runtimeFlavor: mono
runtimeFlavor: ${{ parameters.runtimeFlavor }}
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
${{ if eq(parameters.passPlatforms, true) }}:
Expand All @@ -402,7 +402,7 @@ jobs:
targetRid: maccatalyst-arm64
platform: MacCatalyst_arm64
jobParameters:
runtimeFlavor: mono
runtimeFlavor: ${{ parameters.runtimeFlavor }}
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
${{ if eq(parameters.passPlatforms, true) }}:
Expand Down
18 changes: 11 additions & 7 deletions eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
- name: compilerArg
value: ''
# AppleClang has different version scheme, so we let complier introspection pick up the available clang from PATH
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}:
- name: compilerArg
value: ''
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
# Linux builds use docker images with dependencies preinstalled,
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}:
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'windows') }}:
Expand All @@ -175,7 +175,7 @@ jobs:
continueOnError: false
condition: and(succeeded(), in(variables['SignType'], 'real', 'test'))

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
Expand All @@ -194,15 +194,19 @@ jobs:
- script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg)
displayName: Build CoreCLR Runtime

- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build

# Build CoreCLR Managed Components
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
- ${{ if ne(parameters.osGroup, 'MacCatalyst') }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
- ${{ if eq(parameters.osGroup, 'MacCatalyst') }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components

# Run CoreCLR Tools unit tests
- ${{ if eq(parameters.testGroup, 'clrTools') }}:
Expand All @@ -216,7 +220,7 @@ jobs:

# Sign and add entitlements to these MacOS binaries
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst') }}:

- template: /eng/pipelines/common/macos-sign-with-entitlements.yml
parameters:
Expand Down
4 changes: 4 additions & 0 deletions eng/pipelines/coreclr/templates/xplat-pipeline-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,8 @@ jobs:
- name: osArg
value: -os FreeBSD

- ${{ if eq(parameters.osGroup, 'MacCatalyst') }}:
- name: osArg
value: -os MacCatalyst

steps: ${{ parameters.steps }}
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04

# force a value for OS when cross-building
- ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}:
- ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'MacCatalyst', 'tvOS', 'Android', 'FreeBSD') }}:
- _osArg: -os ${{ parameters.osGroup }}

- ${{ if ne(parameters.framework, '') }}:
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
# If platform is in testBuildPlatforms we build tests as well.
- ${{ if or(eq(parameters.runTests, true), containsValue(parameters.testBuildPlatforms, parameters.platform)) }}:
- _subset: libs+libs.tests
- _additionalBuildArguments: /p:ArchiveTests=true
- _additionalBuildArguments: /p:ArchiveTests=true /p:RuntimeFlavor=${{ parameters.runtimeFlavor }}

- ${{ parameters.variables }}

Expand Down
8 changes: 8 additions & 0 deletions eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ jobs:
- OSX.1014.Amd64.Open
- OSX.1015.Amd64.Open

# Mac Catalyst arm64
- ${{ if eq(parameters.platform, 'MacCatalyst_arm64') }}:
- OSX.1100.ARM64.Open

# Mac Catalyst x64
- ${{ if eq(parameters.platform, 'MacCatalyst_x64') }}:
- OSX.1015.Amd64.Open

# Android
- ${{ if in(parameters.platform, 'Android_x86', 'Android_x64') }}:
- Ubuntu.1804.Amd64.Android.Open
Expand Down
28 changes: 28 additions & 0 deletions eng/pipelines/runtime-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,34 @@ jobs:
buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig)
timeoutInMinutes: 120

#
# CoreCLR Build for running Mac Catalyst libraries-innerloop
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
buildConfig: release
platforms:
- MacCatalyst_x64
jobParameters:
testGroup: innerloop
#
# Libraries Build for running Mac Catalyst libraries-innerloop
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/build-job.yml
buildConfig: Release
platforms:
- MacCatalyst_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: ${{ variables['isOfficialBuild'] }}
isFullMatrix: ${{ variables['isFullMatrix'] }}
runTests: true
testScope: innerloop
liveRuntimeBuildConfig: release

#
# CoreCLR Build for running Apple Silicon libraries-innerloop
#
Expand Down
8 changes: 6 additions & 2 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<UseDefaultAndroidFeatureSwitches Condition="'$(UseDefaultAndroidFeatureSwitches)' == ''">true</UseDefaultAndroidFeatureSwitches>
<UseDefaultiOSFeatureSwitches Condition="'$(UseDefaultiOSFeatureSwitches)' == ''">true</UseDefaultiOSFeatureSwitches>
<BundleTestAppTargets>BundleTestAppleApp;BundleTestAndroidApp</BundleTestAppTargets>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">mono</RuntimeFlavor>
<HeadersPath>$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0</HeadersPath>
<HeadersPath Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(RuntimeArtifactsPath)' != ''">$(CoreCLRArtifactsPath)inc</HeadersPath>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetOS)' == 'Android' and '$(UseDefaultAndroidFeatureSwitches)' == 'true'">
Expand Down Expand Up @@ -190,7 +193,7 @@
TargetOS="$(TargetOS)"
Arch="$(TargetArchitecture)"
ProjectName="$(AssemblyName)"
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0"
RuntimeHeaders="$(HeadersPath)"
Assemblies="@(BundleAssemblies)"
MainLibraryFileName="$(MainLibraryFileName)"
ForceAOT="$(RunAOTCompilation)"
Expand All @@ -202,7 +205,8 @@
Optimized="$(Optimized)"
DevTeamProvisioning="$(DevTeamProvisioning)"
OutputDirectory="$(BundleDir)"
AppDir="$(PublishDir)">
AppDir="$(PublishDir)"
RuntimeFlavor="$(RuntimeFlavor)">
<Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
<Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
</AppleAppBuilderTask>
Expand Down
2 changes: 1 addition & 1 deletion eng/testing/xunit/xunit.console.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TestResultsName>testResults.xml</TestResultsName>
<UseXunitExcludesTxtFile Condition="'$(TargetOS)' == 'Android' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">true</UseXunitExcludesTxtFile>
<UseXunitExcludesTxtFile Condition="'$(TargetOS)' == 'Android' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'MacCatalyst'">true</UseXunitExcludesTxtFile>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsMobile)' != 'true' and '$(TestSingleFile)' != 'true'">
Expand Down
17 changes: 9 additions & 8 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ include(pgosupport.cmake)
#---------------------------------------------------
include(components.cmake)

#---------------------------
# Build the single file host
#---------------------------
if(NOT CLR_CROSS_COMPONENTS_BUILD)
set(CLR_SINGLE_FILE_HOST_ONLY 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static)
add_dependencies(runtime singlefilehost)
endif()
#-------------------------
# Enable C++ EH with SEH
#-------------------------
Expand Down Expand Up @@ -143,6 +135,15 @@ endif(CLR_CMAKE_HOST_WIN32)
#----------------------------------
include(clrdefinitions.cmake)

#---------------------------
# Build the single file host
#---------------------------
if(NOT CLR_CROSS_COMPONENTS_BUILD)
set(CLR_SINGLE_FILE_HOST_ONLY 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static)
add_dependencies(runtime singlefilehost)
endif()

if(FEATURE_STANDALONE_GC)
add_definitions(-DFEATURE_STANDALONE_GC)
add_subdirectory(gc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<ILLinkDirectory>$(MSBuildThisFileDirectory)src\ILLink\</ILLinkDirectory>

<FeaturePortableThreadPool>true</FeaturePortableThreadPool>

<IsiOSLike Condition="'$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">true</IsiOSLike>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -287,6 +289,12 @@
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\CustomMarshalers\TypeToTypeInfoMarshaler.cs" />
<Compile Include="$(BclSourcesRoot)\System\Variant.cs" />
</ItemGroup>
<ItemGroup Condition="'$(IsiOSLike)' == 'true'">
<Compile Include="$(BclSourcesRoot)\System\Environment.iOS.cs"/>
<Compile Include="$(CommonPath)Interop\OSX\System.Native\Interop.SearchPath.cs">
<Link>Common\Interop\OSX\Interop.SearchPath.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(BclSourcesRoot)\Interop\Unix\Interop.Libraries.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\ClrThreadPoolBoundHandle.Unix.cs" />
Expand Down
Loading