diff --git a/build-source-tarball.sh b/build-source-tarball.sh index 109b3aa546..b40348753e 100755 --- a/build-source-tarball.sh +++ b/build-source-tarball.sh @@ -12,6 +12,32 @@ if [ -z "${1:-}" ]; then exit 1 fi +# Use uname to determine what the CPU is. +cpuname=$(uname -p) +# Some Linux platforms report unknown for platform, but the arch for machine. +if [[ "$cpuname" == "unknown" ]]; then + cpuname=$(uname -m) +fi + +case $cpuname in + aarch64) + targetArchitecture=arm64 + ;; + amd64|x86_64) + targetArchitecture=x64 + ;; + armv7l) + targetArchitecture=arm + ;; + i686) + targetArchitecture=x86 + ;; + *) + echo "Unknown CPU $cpuname detected, treating it as x64" + targetArchitecture=x64 + ;; +esac + TARBALL_ROOT=$1 shift @@ -148,9 +174,6 @@ git submodule foreach --quiet --recursive ' # Now re-uberclone into the tarball src directory. Since we reuse the .gitdirs, this shouldn't hit the network at all. ignored_repos="https://dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/devdiv/DevDiv/_git/DotNet-Trusted;https://devdiv.visualstudio.com/DevDiv/_git/DotNet-Trusted;https://dnceng@dev.azure.com/dnceng/internal/_git/dotnet-optimization;https://dev.azure.com/dnceng/internal/_git/dotnet-core-setup;https://github.com/dotnet/source-build-reference-packages" -#export the LC_LIB_PATH for libgit2 so file as fedora fails to find it in the repodir -export LD_LIBRARY_PATH=$CLI_PATH/tools/.store/microsoft.dotnet.darc/$DarcVersion/microsoft.dotnet.darc/$DarcVersion/tools/netcoreapp2.1/any/runtimes/rhel-x64/native/ - "$CLI_PATH/dotnet" "$DARC_DLL" clone --repos-folder=$TARBALL_ROOT/src/ --git-dir-folder $SCRIPT_ROOT/.git/modules/src/ --include-toolset --ignore-repos "$ignored_repos" --azdev-pat bogus --github-pat bogus --depth 0 --debug # now we don't need .git/modules/src or Darc anymore @@ -208,20 +231,20 @@ cp $SCRIPT_ROOT/support/tarball/build.sh $TARBALL_ROOT/build.sh mkdir -p $TARBALL_ROOT/packages/prebuilt mkdir -p $TARBALL_ROOT/packages/source-built find $SCRIPT_ROOT/packages/restored/ -name '*.nupkg' -exec cp {} $TARBALL_ROOT/packages/prebuilt/ \; -find $SCRIPT_ROOT/bin/obj/x64/Release/nuget-packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/packages/prebuilt/ \; +find $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/nuget-packages -name '*.nupkg' -exec cp {} $TARBALL_ROOT/packages/prebuilt/ \; # Copy reference-packages from bin dir to reference-packages directory. # See corresponding change in dir.props to change ReferencePackagesBasePath conditionally in offline build. mkdir -p $TARBALL_ROOT/packages/reference -cp -r $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/source $TARBALL_ROOT/packages/reference/source -cp -r $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/staging $TARBALL_ROOT/packages/reference/staging +cp -r $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/reference-packages/source $TARBALL_ROOT/packages/reference/source +cp -r $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/reference-packages/staging $TARBALL_ROOT/packages/reference/staging # Copy tarballs to ./packages/archive directory mkdir -p $TARBALL_ROOT/packages/archive -cp -r $SCRIPT_ROOT/bin/obj/x64/Release/external-tarballs/*.tar.gz $TARBALL_ROOT/packages/archive/ +cp -r $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/external-tarballs/*.tar.gz $TARBALL_ROOT/packages/archive/ # Copy generated source from bin to src/generatedSrc -cp -r $SCRIPT_ROOT/bin/obj/x64/Release/generatedSrc $TARBALL_ROOT/src/generatedSrc +cp -r $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/generatedSrc $TARBALL_ROOT/src/generatedSrc if [ -e $SCRIPT_ROOT/testing-smoke/smoke-test-packages ]; then cp -rf $SCRIPT_ROOT/testing-smoke/smoke-test-packages $TARBALL_ROOT/packages @@ -229,7 +252,7 @@ fi echo 'Removing source-built packages from tarball prebuilts...' -for built_package in $(find $SCRIPT_ROOT/bin/obj/x64/Release/blob-feed/packages/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]') +for built_package in $(find $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/blob-feed/packages/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]') do if [ -e $TARBALL_ROOT/packages/prebuilt/$(basename $built_package) ]; then rm $TARBALL_ROOT/packages/prebuilt/$(basename $built_package) @@ -250,8 +273,8 @@ cp $SCRIPT_ROOT/bin/obj/x64/Release/blob-feed/packages/*DotNetHost*.nupkg $TARBA cp $SCRIPT_ROOT/bin/obj/x64/Release/blob-feed/packages/*DotNetAppHost*.nupkg $TARBALL_ROOT/packages/source-built/ # Setup package version props to include both source-built and running PackageVersions.props -mkdir --parents $TARBALL_ROOT/bin/obj/x64/Release/ -cp $SCRIPT_ROOT/support/tarball/PackageVersions.props $TARBALL_ROOT/bin/obj/x64/Release/ +mkdir --parents $TARBALL_ROOT/bin/obj/$targetArchitecture/Release/ +cp $SCRIPT_ROOT/support/tarball/PackageVersions.props $TARBALL_ROOT/bin/obj/$targetArchitecture/Release/ if [ $INCLUDE_LEAK_DETECTION -eq 1 ]; then echo 'Building leak detection MSBuild tasks...' @@ -261,7 +284,7 @@ fi echo 'Removing reference-only packages from tarball prebuilts...' -for ref_package in $(find $SCRIPT_ROOT/bin/obj/x64/Release/reference-packages/packages-to-delete/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]') +for ref_package in $(find $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/reference-packages/packages-to-delete/ -name '*.nupkg' | tr '[:upper:]' '[:lower:]') do if [ -e $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package) ]; then rm $TARBALL_ROOT/packages/prebuilt/$(basename $ref_package) @@ -292,7 +315,7 @@ done echo 'Removing source-built, previously source-built packages and reference packages from il pkg src...' OLDIFS=$IFS -allBuiltPkgs=(`ls $SCRIPT_ROOT/bin/obj/x64/Release/blob-feed/packages/*.nupkg | xargs -n1 basename | tr '[:upper:]' '[:lower:]'`) +allBuiltPkgs=(`ls $SCRIPT_ROOT/bin/obj/$targetArchitecture/Release/blob-feed/packages/*.nupkg | xargs -n1 basename | tr '[:upper:]' '[:lower:]'`) pushd $TARBALL_ROOT/packages/reference/staging/ ilSrcPaths=(`find . -maxdepth 2 -mindepth 2`) popd diff --git a/build.sh b/build.sh index cba68e98c3..945bf4b8df 100755 --- a/build.sh +++ b/build.sh @@ -69,8 +69,9 @@ export NUGET_PACKAGES="$scriptroot/packages/restored/" set -x scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -# runtime 2.1.0 required for darc -"$scriptroot/eng/common/dotnet-install.sh" -runtime dotnet -version 2.1.0 +# HACK ALERT. runtime 2.1.0 required for darc. But that doesn't work too well on arm64. Instead, pretend 3.0.0 is 2.1.0. +"$scriptroot/eng/common/dotnet-install.sh" -runtime dotnet -version 3.0.0 +[ -f $scriptroot/.dotnet/shared/Microsoft.NETCore.App/2.1.0 ] || ln -s 3.0.0 $scriptroot/.dotnet/shared/Microsoft.NETCore.App/2.1.0 if [ "$alternateTarget" == "true" ]; then CLIPATH="$scriptroot/.dotnet" diff --git a/dir.props b/dir.props index 6cc0c62793..295dfdb707 100644 --- a/dir.props +++ b/dir.props @@ -2,6 +2,9 @@ Release + + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) + $(BuildArchitecture) x64 @@ -198,7 +201,7 @@ - + diff --git a/patches/aspnetcore/0011-Support-global.json-on-arm64-as-well.patch b/patches/aspnetcore/0011-Support-global.json-on-arm64-as-well.patch new file mode 100644 index 0000000000..aba377504c --- /dev/null +++ b/patches/aspnetcore/0011-Support-global.json-on-arm64-as-well.patch @@ -0,0 +1,33 @@ +From 84d274a8f3d416b0a5bd999e3d1c43ae1535e38f Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Wed, 23 Oct 2019 15:43:57 -0400 +Subject: [PATCH] Support global.json on arm64 as well + +arcade uses the runtime section of global.json to decide which +architecture + runtime combination needs to be installed. + +With https://github.com/dotnet/arcade/pull/4132 arcade can install +foreign SDKs in separate locations correctly. + +This change, suggested by @dougbu, makes arcade always install the +runtime for the local architecture (which means it should work on arm64 +and x64) as well as the x86 architecture (skipped on Linux). + +This gets us a working SDK/Runtime combo on arm64. +--- + global.json | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/global.json b/global.json +index 602f4f44e17..40dec559cc9 100644 +--- a/global.json ++++ b/global.json +@@ -5,7 +5,7 @@ + "tools": { + "dotnet": "3.0.100", + "runtimes": { +- "dotnet/x64": [ ++ "dotnet": [ + "$(MicrosoftNETCoreAppRuntimeVersion)" + ], + "dotnet/x86": [ diff --git a/patches/aspnetcore/0012-Support-building-for-arm64-on-arm64-nix.patch b/patches/aspnetcore/0012-Support-building-for-arm64-on-arm64-nix.patch new file mode 100644 index 0000000000..22b10ce6e3 --- /dev/null +++ b/patches/aspnetcore/0012-Support-building-for-arm64-on-arm64-nix.patch @@ -0,0 +1,85 @@ +From e2946a26c11be7f7f0c223721a5b14f58f2ea240 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Mon, 11 Nov 2019 13:37:40 -0500 +Subject: [PATCH] Support building for arm64 on arm64 (*nix) + +This commit allows ASP.NET Core to be built on arm64 machines directly, +without relying on cross-compilation. + +There's a few changes in here: + +1. Ask msbuild to look into the BuildArchitecture + + By default, our build systems assums the machine is x64. This + modifies the build configuration to check the architecture of the + currently running build machine, and set BuildArchitecture to that. + +2. Fix crossgen in Microsoft.AspNetCore.App.Runtime + + We run crossgen for supported architectures (including x64 and + arm64). For that, we need a jit that we can point crossgen to. + Generally, we can rely on the build scripts to find the right + `libclrjit.so`. However, arm64 has multiple `libclirjit.so`, for + different use-cases. There's one for arm64 (for running on arm64) and + there's another one for cross-compiling for arm64 on x64. We need to + figure out and use the right one explicitly rather than assuming the + right one gets picked up. + + See https://github.com/dotnet/core-setup/pull/8468 for similar + changes made in core-setup. + +This also needs https://github.com/aspnet/AspNetCore/pull/14790 to fully +work on arm64. +--- + Directory.Build.props | 1 + + .../src/Microsoft.AspNetCore.App.Runtime.csproj | 12 ++++++++---- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index b3dc903387f..1bd59d73121 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -108,6 +108,7 @@ + win + osx + linux ++ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) + x64 + $(TargetOsName)-$(TargetArchitecture) + +diff --git a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj +index 4c4298a92da..f843ded1241 100644 +--- a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj ++++ b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj +@@ -90,15 +90,17 @@ This package is an internal implementation of the .NET Core SDK and is not meant + : + %3B + ++ x64_arm ++ x64_arm64 ++ x86_arm ++ + + crossgen + $(CrossgenToolFileName).exe + + $(CrossgenToolFileName) + +- x64_arm\$(CrossgenToolPackagePath) +- x64_arm64\$(CrossgenToolPackagePath) +- x86_arm\$(CrossgenToolPackagePath) ++ $(CrossCompileDirectory)\$(CrossgenToolPackagePath) + + $(RuntimeIdentifier) + $(SourceBuildRuntimeIdentifier) +@@ -293,7 +295,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant + + $(IntermediateOutputPath)crossgen\ + $(IntermediateOutputPath)platformAssemblies\ +- $(CrossgenToolDir)$(LibPrefix)clrjit$(LibExtension) ++ ++ $(RuntimePackageRoot)runtimes\$(RuntimeIdentifier)\native\$(LibPrefix)clrjit$(LibExtension) ++ $(RuntimepackageRoot)runtimes\$(CrossCompileDirectory)\native\$(LibPrefix)clrjit$(LibExtension) + + + diff --git a/patches/core-sdk/0001-Enable-building-on-arm64-machines.patch b/patches/core-sdk/0001-Enable-building-on-arm64-machines.patch new file mode 100644 index 0000000000..3d33248083 --- /dev/null +++ b/patches/core-sdk/0001-Enable-building-on-arm64-machines.patch @@ -0,0 +1,116 @@ +From 4b5c617203cfb9d2c1b12995e12d819fba6d7b6f Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Tue, 8 Oct 2019 17:02:29 -0400 +Subject: [PATCH] Enable building on arm64 machines + +With this commit, I can build core-sdk on RHEL 8 on arm64 directly, +without cross compilation. + +Bump the sourcelink version to pick up the ability to parse git info +without depending on libgit2sharp. This allows sourcelink to work on +arm64. The version is the same as the one recently added to core-setup: +https://github.com/dotnet/core-setup/pull/7696 + +Introduce a new 'BuildArchitecture' msbuild property that contains the host +architecture (arm64, x64, etc). This is the architecture of the +currently running machine, and may be different from the architecture we +are targetting in the case of cross compilation. + +There's a gotcha with BuildArchitecture: under Visual Studio (an x86) process, +we generally want a x64 architecture. So try and restrict it to arm64 only. + +Use BuildArchitecture to determine whether _crossDir and LibCLRJitRid need to +be special-cased for arm64 or or not. +--- + Directory.Build.props | 6 ++++++ + eng/Versions.props | 2 +- + src/redist/targets/Crossgen.targets | 6 +++--- + src/redist/targets/GenerateLayout.targets | 4 ++-- + src/redist/targets/GetRuntimeInformation.targets | 1 - + 5 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index b65a72410..be3834859 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -7,6 +7,12 @@ + MIT + + ++ ++ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) ++ $(BuildArchitecture) ++ x64 ++ ++ + + True + embedded +diff --git a/eng/Versions.props b/eng/Versions.props +index 344a325bf..37e478e72 100644 +--- a/eng/Versions.props ++++ b/eng/Versions.props +@@ -87,7 +87,7 @@ + $(BuildTasksFeedToolVersion) + 2.0.0 + 15.8.0 +- 1.0.0-beta2-18618-05 ++ 1.0.0-beta2-19367-01 + + + +diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets +index 8d3091307..931dff2d9 100644 +--- a/src/redist/targets/Crossgen.targets ++++ b/src/redist/targets/Crossgen.targets +@@ -5,14 +5,14 @@ + + + microsoft.netcore.app.runtime.$(SharedFrameworkRid) +- <_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64 ++ <_crossDir Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">/x64_arm64 + <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm + <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">/x64_arm + $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension) +- $(SharedFrameworkRid) +- x64_arm64 ++ x64_arm64 + x86_arm + x64_arm ++ $(SharedFrameworkRid) + $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension) + $(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppRuntimePackageVersion) + * +diff --git a/src/redist/targets/GenerateLayout.targets b/src/redist/targets/GenerateLayout.targets +index d2a0b6fd1..a0bcf6f35 100644 +--- a/src/redist/targets/GenerateLayout.targets ++++ b/src/redist/targets/GenerateLayout.targets +@@ -25,11 +25,11 @@ + + + $(CoreSetupRid) +- x64 ++ $(Architecture) + + + $(CoreSetupRid) +- x64 ++ $(Architecture) + + dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension) + dotnet-hostfxr$(InstallerStartSuffix)-$(HostFxrVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension) +diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets +index 3b14d1203..f49c7262f 100644 +--- a/src/redist/targets/GetRuntimeInformation.targets ++++ b/src/redist/targets/GetRuntimeInformation.targets +@@ -13,7 +13,6 @@ + linux + linux + +- x64 + $(OSName)-$(Architecture) + + +-- +2.18.1 + diff --git a/patches/core-setup/8468.patch b/patches/core-setup/8468.patch new file mode 100644 index 0000000000..f8a38287ff --- /dev/null +++ b/patches/core-setup/8468.patch @@ -0,0 +1,81 @@ +From c02027bfee1c523006430183d37c1b61072d5ed8 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Fri, 4 Oct 2019 16:08:59 -0400 +Subject: [PATCH] Enable building for arm64 on arm64 + +To enable building core-setup on arm64 machines (not cross compiled), we need +to do a few things: + +- Set the right TargetArchitecture + + When `TargetArchitecture` is not explicitly specified and when the currently + running architecture is Arm64, use arm64 as the `TargetArchitecture`. Don't + always use the currently running architecture as that doesn't play well with + an x86 Visual Studio trying to create x64 builds. + +- Use the right coreclr JIT + + If we are cross-compiling, we need to use the x86_arm64 libclrjit.so. But if + we are building on an arm64 machine, we need to filter the list of found + libclrjit.so files to pick the normal-RID (eg, linux-arm64) libclrjit.so from + the two: + + ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit//runtimes/linux-arm64/native/libclrjit.so + ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit//runtimes/x64_arm64/native/libclrjit.so +--- + Directory.Build.props | 4 +++- + src/pkg/packaging-tools/framework.dependency.targets | 7 +++---- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index a53af2f09f..a7e9169c91 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -94,6 +94,8 @@ + + + ++ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) ++ $(BuildArchitecture) + x64 + $(TargetArchitecture) + +@@ -398,4 +400,4 @@ + true + + +- +\ No newline at end of file ++ +diff --git a/src/pkg/packaging-tools/framework.dependency.targets b/src/pkg/packaging-tools/framework.dependency.targets +index 3e7afc5483..14ac018b02 100644 +--- a/src/pkg/packaging-tools/framework.dependency.targets ++++ b/src/pkg/packaging-tools/framework.dependency.targets +@@ -254,7 +254,7 @@ + + <_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' == 'Windows_NT'">/x86_arm + <_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' != 'Windows_NT'">/x64_arm +- <_crossDir Condition="'$(TargetArchitecture)' == 'arm64'">/x64_arm64 ++ <_crossDir Condition="'$(TargetArchitecture)' == 'arm64' AND '$(BuildArchitecture)' != 'arm64'">/x64_arm64 + + + +@@ -272,7 +272,6 @@ + + <_runtimeCLR Include="$(_runtimePackageDir)**/$(LibraryFilePrefix)coreclr$(LibraryFileExtension)" /> + <_runtimeCoreLib Include="$(_runtimePackageDir)**/native/System.Private.CoreLib.dll" /> +- <_runtimeJIT Include="$(_jitPackageDir)**/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)" /> + <_fxSystemRuntime Include="$(_corefxPackageDir)**/System.Runtime.dll" /> + <_windowsWinMD Include="$(_winmdPackageDir)**/Windows.winmd" /> + <_diaSymReaderAssembly Include="$(_diaSymReaderPackageDir)**\Microsoft.DiaSymReader.Native.*.dll" /> +@@ -287,8 +286,8 @@ + <_coreLibDirectory>%(_runtimeCoreLib.RootDir)%(_runtimeCoreLib.Directory) + + +- +- <_jitPath>%(_runtimeJIT.FullPath) ++ ++ <_jitPath Condition="'$(_crossDir)' == ''">$(_jitPackageDir)runtimes/$(PackageRID)/native/$(LibraryFilePrefix)clrjit$(LibraryFileExtension) + <_jitPath Condition="'$(_crossDir)' != ''">$(_jitPackageDir)runtimes$(_crossDir)/native/$(LibraryFilePrefix)clrjit$(LibraryFileExtension) + + diff --git a/patches/corefx/40453.patch b/patches/corefx/40453.patch new file mode 100644 index 0000000000..fa16d54a19 --- /dev/null +++ b/patches/corefx/40453.patch @@ -0,0 +1,46 @@ +From d36274c31cc30a946c023b7a5bb5c6fa1ff86625 Mon Sep 17 00:00:00 2001 +From: Omair Majid +Date: Tue, 20 Aug 2019 13:40:19 -0400 +Subject: [PATCH] Enable build on hosted arm64 + +This is attempt #2. The first attempt was commit +176da26d634fd760d7c8c99956f2e8d3f7d485e7. + +Initialize HostArch to the arch-style used in RIDs directly by +converting things to lowercase. + +Use the HostArch for the tool runtime instead of assuming x64. +--- + Directory.Build.props | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index fe1f406a02d7..dae20af84cc1 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -64,9 +64,9 @@ + netcoreapp + $(DefaultOSGroup) + Debug +- $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture) +- arm +- arm64 ++ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) ++ arm ++ arm64 + x64 + + +@@ -135,9 +135,10 @@ + <_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">linux + <_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.5.0.0'">linux + <_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS) +- $(_runtimeOS)-x64 ++ $(_runtimeOS)-x64 ++ $(_runtimeOS)-$(HostArch) + +- linux-x64 ++ linux-x64 + + + win-x64 diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj index 998a24f032..71aedf3f79 100644 --- a/repos/aspnetcore.proj +++ b/repos/aspnetcore.proj @@ -11,6 +11,7 @@ $(BuildCommandArgs) --configuration $(Configuration) $(BuildCommandArgs) --ci $(BuildCommandArgs) -bl + $(BuildCommandArgs) --arch $(Platform) $(BuildCommandArgs) /p:BuildNodeJs=false $(BuildCommandArgs) /p:SourceBuildRuntimeIdentifier=$(TargetRid) $(BuildCommandArgs) /p:UseAppHost=false diff --git a/repos/core-sdk.proj b/repos/core-sdk.proj index c3b8f22631..ba5717dafa 100644 --- a/repos/core-sdk.proj +++ b/repos/core-sdk.proj @@ -6,7 +6,7 @@ $(TargetRid.Substring(0, $(TargetRid.IndexOf("-")))) $(BuildCommandArgs) /p:Rid=$(TargetRid) - $(BuildCommandArgs) /p:AspNetCoreSharedFxInstallerRid=linux-x64 + $(BuildCommandArgs) /p:AspNetCoreSharedFxInstallerRid=linux-$(Platform) $(BuildCommandArgs) /p:OSName=$(OSNameOverride) $(BuildCommandArgs) /p:CoreSetupRid=osx-x64 diff --git a/repos/core-setup.proj b/repos/core-setup.proj index c09c9bd193..644c606f68 100644 --- a/repos/core-setup.proj +++ b/repos/core-setup.proj @@ -13,7 +13,7 @@ $(BuildArguments) $(FlagParameterPrefix)configuration $(Configuration) $(BuildArguments) $(FlagParameterPrefix)ci $(BuildArguments) /p:PortableBuild=$(OverridePortable) - $(BuildArguments) /p:TargetArchitecture=$(Platform) /p:DisableCrossgen=true /p:CrossBuild=true + $(BuildArguments) /p:TargetArchitecture=$(Platform) /p:DisableCrossgen=true /p:CrossBuild=true $(BuildArguments) /p:BuildDebPackage=false $(BuildArguments) /p:BuildAllPackages=true $(BuildArguments) /p:RestoreAllBuildRids=false @@ -28,7 +28,7 @@ $(BuildArguments) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg) $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) - $(ArmEnvironmentVariables) $(BuildCommand) + $(ArmEnvironmentVariables) $(BuildCommand) false $(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/ diff --git a/repos/coreclr.proj b/repos/coreclr.proj index 775a0c034f..5a54c0c533 100644 --- a/repos/coreclr.proj +++ b/repos/coreclr.proj @@ -10,7 +10,7 @@ $(BuildArguments) -nopgooptimize $(BuildArguments) msbuildonunsupportedplatform $(BuildArguments) cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE - $(BuildArguments) skipnuget cross -skiprestore cmakeargs -DFEATURE_GDBJIT=TRUE + $(BuildArguments) skipnuget cross -skiprestore cmakeargs -DFEATURE_GDBJIT=TRUE @@ -26,7 +26,7 @@ $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) - $(ArmEnvironmentVariables) $(BuildCommand) + $(ArmEnvironmentVariables) $(BuildCommand) $(ProjectDirectory)/clean$(ShellExtension) diff --git a/repos/corefx.proj b/repos/corefx.proj index 8a1cddf876..c9d55a0359 100644 --- a/repos/corefx.proj +++ b/repos/corefx.proj @@ -50,7 +50,7 @@ $(BuildArguments) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg) $(FlagParameterPrefix)ci $(ProjectDirectory)/build$(ShellExtension) $(BuildArguments) - $(ArmEnvironmentVariables) $(BuildCommand) + $(ArmEnvironmentVariables) $(BuildCommand) false $(ProjectDirectory)artifacts/packages/$(Configuration)/Shipping/ diff --git a/repos/known-good.proj b/repos/known-good.proj index 99e3a9b810..1771bfeb9d 100644 --- a/repos/known-good.proj +++ b/repos/known-good.proj @@ -19,7 +19,7 @@ - + diff --git a/tools-local/init-build.proj b/tools-local/init-build.proj index d20e6b1ecc..20e46ebe60 100644 --- a/tools-local/init-build.proj +++ b/tools-local/init-build.proj @@ -75,7 +75,7 @@ - + @@ -174,7 +174,7 @@ $(DotNetCliToolDir)dotnet $(DarcDll) $(DarcCloneArguments) - +