Skip to content

Commit

Permalink
Try with new patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ta264 committed Apr 12, 2022
1 parent 3941bac commit 1cadc41
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 104 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:20.04

RUN apt-get update && \
apt-get install -y gpg curl wget software-properties-common && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \
apt-get update && \
apt-get install -y cmake llvm-9 clang-9 autoconf automake libtool build-essential python curl git lldb-6.0 liblldb-6.0-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libssl-dev libnuma-dev libkrb5-dev zlib1g-dev debootstrap qemu-user-static locales && \
locale-gen "en_US.UTF-8"

RUN mkdir /tmp/x86 /crossrootfs && \
curl -s -o /tmp/build-rootfs.sh https://raw.githubusercontent.com/dotnet/runtime/main/eng/common/cross/build-rootfs.sh && \
curl -s -o /tmp/x86/sources.list.xenial https://raw.githubusercontent.com/dotnet/runtime/main/eng/common/cross/x86/sources.list.xenial && \
chmod a+x /tmp/build-rootfs.sh && \
/tmp/build-rootfs.sh x86 --skipunmount --rootfsdir /crossrootfs

ENV ROOTFS_DIR=/crossrootfs
57 changes: 34 additions & 23 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ parameters:
- name: runtimeBranch
displayName: Tag for runtime repository
type: string
default: v6.0.2
default: v6.0.3
- name: aspBranch
displayName: Tag for aspnetcore repository
type: string
default: v6.0.2
default: v6.0.3
- name: sdkBranch
displayName: Tag for sdk repository
type: string
default: v6.0.200
default: v6.0.201
- name: installerBranch
displayName: Tag for installer repository
type: string
default: v6.0.200
default: v6.0.201

variables:
runCounter: $[counter('runNumber', 1)]
Expand Down Expand Up @@ -54,7 +54,7 @@ stages:
- stage: Runtime

pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'

jobs:
- job: Setup
Expand All @@ -72,22 +72,28 @@ stages:
- bash: |
set -e
git -C runtime checkout ${{ parameters.runtimeBranch }}
git -C runtime cherry-pick -n 3633a7d0930abaca701385c1059b80ca157e98c6
git -C runtime cherry-pick -n 3e6d492bdf6fbf2d8af3871379f31dcc6e27716b
# git -C runtime apply ../dotnet-linux-x86/patches/runtime/0001-Fix-build-for-linux-x86.patch
git -C runtime apply ../dotnet-linux-x86/patches/runtime/0001-Fix-duplicate-definition-of-_RUNTIME_FUNCTION-on-lin.patch
git -C runtime cherry-pick -n 7263ce5562ffd4bc515269add609886ea3d907d8
git -C runtime cherry-pick -n -Xtheirs 7d7b56e4416555c41c55ef2dc25d3f65d6c3d471
git -C runtime cherry-pick -n -Xtheirs bfcb5426ebec6cbfa67d5ca09bcc4a1d5a5216a3
sed -i 's/return/__SkipCrossArchBuild=0/' runtime/src/coreclr/build-runtime.sh
sed -i '/AppHostRuntimeIdentifier/d' runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj
sed -i '/\/dnceng\/internal\//d' runtime/NuGet.config
sed -i '/PublishReadyToRun Condition/a \ \ \ \ <PublishReadyToRun>false<\/PublishReadyToRun>' runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
sed -i '/crossgen-corelib/d' runtime/eng/Subsets.props
displayName: Checkout and patch
- bash: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update
sudo apt-get install -y cmake llvm-9 clang-9 autoconf automake libtool build-essential python curl git lldb-6.0 liblldb-6.0-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libssl-dev libnuma-dev libkrb5-dev zlib1g-dev debootstrap qemu-user-static
sudo runtime/eng/common/cross/build-rootfs.sh x86
export ROOTFS_DIR=$(pwd)/runtime/.tools/rootfs/x86
echo $ROOTFS_DIR
runtime/build.sh -ci -c Release -cross -arch x86
docker build -t dotnet-linux-x86 - < dotnet-linux-x86/Dockerfile
displayName: Build cross root
- bash: |
source dotnet-linux-x86/common.sh
calculate_build_id $(git -C runtime tag --points-at HEAD)
echo $OFFICIALBUILDID
docker run -v ${BUILD_SOURCESDIRECTORY}/runtime:/runtime dotnet-linux-x86 /runtime/eng/build.sh -ci -c Release -cross -os Linux -arch x86 /p:OfficialBuildId=$OFFICIALBUILDID -subset Clr.Native+Host.Native
docker run -v ${BUILD_SOURCESDIRECTORY}/runtime:/runtime dotnet-linux-x86 /runtime/eng/build.sh -ci -c Release -cross -os Linux -arch x86 /p:OfficialBuildId=$OFFICIALBUILDID /p:AppHostSourcePath=/runtime/artifacts/obj/linux-x86.Release/apphost/standalone/apphost || true
displayName: Build Runtime
continueOnError: true
- publish: '$(Build.SourcesDirectory)/runtime/artifacts/packages/Release/Shipping'
artifact: RuntimePackages
displayName: Publish Runtime
Expand All @@ -109,7 +115,7 @@ stages:
git -C sdk checkout ${{ parameters.sdkBranch }}
displayName: Checkout and patch
- bash: |
source dotnet-bsd/common.sh
source dotnet-linux-x86/common.sh
calculate_build_id $(git -C sdk tag --points-at HEAD)
echo $OFFICIALBUILDID
sdk/build.sh -c Release -pack -ci /p:OfficialBuildId=$OFFICIALBUILDID
Expand All @@ -125,7 +131,7 @@ stages:
- stage: AspNetCore
dependsOn: Runtime
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
jobs:
- job: AspNetCore
timeoutInMinutes: 0
Expand All @@ -152,10 +158,13 @@ stages:
Microsoft.*.linux-x86.*.nupkg
- bash: |
set -e
source dotnet-linux-x86/common.sh
calculate_build_id $(git -C aspnetcore tag --points-at HEAD)
echo $OFFICIALBUILDID
ls -lR runtime
mkdir -p aspnetcore/artifacts/obj/Microsoft.AspNetCore.App.Runtime
cp runtime/artifacts/packages/Release/Shipping/dotnet-runtime-*-linux-x86.tar.gz aspnetcore/artifacts/obj/Microsoft.AspNetCore.App.Runtime
aspnetcore/build.sh -c Release -ci -arch x86 -pack -nobl /p:OfficialBuildId=$(date +%Y%m%d)-99
aspnetcore/eng/build.sh -c Release -ci -arch x86 -pack /p:CrossgenOutput=false /p:OfficialBuildId=$(date +%Y%m%d)-99
displayName: Build AspNetCore
- publish: '$(Build.SourcesDirectory)/aspnetcore/artifacts/packages/Release/Shipping'
artifact: AspNetCorePackages
Expand All @@ -167,7 +176,7 @@ stages:
- stage: Installer
dependsOn: AspNetCore
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
jobs:
- job: Installer
timeoutInMinutes: 0
Expand All @@ -182,8 +191,7 @@ stages:
dotnet nuget add source ../runtime/artifacts/packages/Release/Shipping --name runtime --configfile installer/NuGet.config
dotnet nuget add source ../aspnetcore/artifacts/packages/Release/Shipping --name aspnetcore --configfile installer/NuGet.config
sed -i '/\/dnceng\/internal\//d' installer/NuGet.config
sed -i 's/NetCore5AppHostRids Include="@(NetCore31RuntimePackRids)/NetCore5AppHostRids Include="@(NetCore31RuntimePackRids);linux-x86/' installer/src/redist/targets/GenerateBundledVersions.targets
sed -i 's/AspNetCore50RuntimePackRids Include="@(AspNetCore31RuntimePackRids)/AspNetCore50RuntimePackRids Include="@(AspNetCore31RuntimePackRids);linux-x86/' installer/src/redist/targets/GenerateBundledVersions.targets
sed -i 's/linux-s390x/linux-s390x;linux-x86/g' installer/src/redist/targets/GenerateBundledVersions.targets
displayName: Apply patches
- task: DownloadPipelineArtifact@2
inputs:
Expand All @@ -208,12 +216,15 @@ stages:
patterns: 'aspnetcore-runtime-*'
- bash: |
set -e
source dotnet-linux-x86/common.sh
calculate_build_id $(git -C installer tag --points-at HEAD)
echo $OFFICIALBUILDID
ls -lR runtime
ls -lR aspnetcore
mkdir -p installer/artifacts/obj/redist/Release/downloads/
cp runtime/artifacts/packages/Release/Shipping/dotnet-runtime-*-linux-x86.tar.gz installer/artifacts/obj/redist/Release/downloads/
cp aspnetcore/artifacts/installers/Release/aspnetcore-runtime-* installer/artifacts/obj/redist/Release/downloads/
installer/build.sh -c Release -ci -pack -nobl --architecture x86 --runtime-id linux-x64 /p:OfficialBuildId=$(date +%Y%m%d)-99 /p:IncludeAspNetCoreRuntime=True /p:HostRid=linux-x64
installer/build.sh -c Release -ci -pack --architecture x86 --runtime-id linux-x86 /p:DISABLE_CROSSGEN=True /p:OfficialBuildId=$OFFICIALBUILDID /p:IncludeAspNetCoreRuntime=True /p:HostRid=linux-x64
displayName: Build Installer
- publish: '$(Build.SourcesDirectory)/installer/artifacts/packages/Release/Shipping'
artifact: Installer
Expand Down
30 changes: 30 additions & 0 deletions common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

function calculate_build_id()
{
local TAG=$1
local REGEX='-(preview|rc|rtm)\.[0-9]\.([0-9]{5})\.([0-9]{1,2})'

if [[ $TAG =~ $REGEX ]]
then
local MAJOR=${BASH_REMATCH[2]}
local MINOR=${BASH_REMATCH[3]}

YEAR=$((MAJOR / 1000 + 2000))
MONTH=$(((MAJOR % 1000) / 50))
DAY=$((MAJOR % 50))

DATE=$((YEAR * 10000 + MONTH * 100 + DAY))

OFFICIALBUILDID="${DATE}.${MINOR}"
else
OFFICIALBUILDID=$(date +%Y%m%d).99
fi
}

function get_runtime_docker()
{
DOTNET_DOCKER_TAG="mcr.microsoft.com/dotnet-buildtools/prereqs:$(curl -s https://raw.githubusercontent.com/dotnet/versions/master/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-main.json | jq -r '.repos[0].images[] | select(.platforms[0].dockerfile | contains("freebsd/12")) | .platforms[0].simpleTags[0]')"
}
81 changes: 0 additions & 81 deletions patches/runtime/0001-Fix-build-for-linux-x86.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From be37ed0c17773bb0508943b74fd3d8a92f68b9d5 Mon Sep 17 00:00:00 2001
From: ta264 <[email protected]>
Date: Mon, 11 Apr 2022 19:20:20 +0100
Subject: [PATCH] Fix duplicate definition of _RUNTIME_FUNCTION on linux-x86

---
src/coreclr/inc/clrnt.h | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/src/coreclr/inc/clrnt.h b/src/coreclr/inc/clrnt.h
index a833da67bcc..b42ae8a7c9b 100644
--- a/src/coreclr/inc/clrnt.h
+++ b/src/coreclr/inc/clrnt.h
@@ -833,21 +833,6 @@ RtlVirtualUnwind_Unsafe(
//

#ifdef TARGET_X86
-#ifndef TARGET_UNIX
-//
-// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms.
-//
-#ifdef HOST_X86
-typedef struct _RUNTIME_FUNCTION {
- DWORD BeginAddress;
- DWORD UnwindData;
-} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
-
-typedef struct _DISPATCHER_CONTEXT {
- _EXCEPTION_REGISTRATION_RECORD* RegistrationPointer;
-} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
-#endif // HOST_X86
-#endif // !TARGET_UNIX

#define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress
#define RUNTIME_FUNCTION__SetBeginAddress(prf,addr) ((prf)->BeginAddress = (addr))
--
2.25.1

33 changes: 33 additions & 0 deletions patches/runtime/0002-Build-Crossgen2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 7f77f930426f5ac3a992e58c93c8b2b50d40cac5 Mon Sep 17 00:00:00 2001
From: ta264 <[email protected]>
Date: Mon, 11 Apr 2022 21:17:32 +0100
Subject: [PATCH] Build Crossgen2

---
.../Microsoft.NETCore.App.Crossgen2.sfxproj | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj
index 4c3c0f82a1a..9578320427b 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj
@@ -11,7 +11,7 @@
<ArchiveName>dotnet-crossgen2</ArchiveName>
<SharedFrameworkHostFileNameOverride>crossgen2</SharedFrameworkHostFileNameOverride>
<!-- Build this pack for any RID if building from source. Otherwise, only build select RIDs. -->
- <RuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers>
+ <RuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' != 'true'">linux-x64;linux-x86;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers>
<GenerateInstallers>false</GenerateInstallers>
<GetSharedFrameworkFilesForReadyToRunDependsOn>
AddRuntimeFilesToPackage;
@@ -38,6 +38,7 @@
<NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)jitinterface_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
<NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_x86_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
<NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_arm_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
+ <NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_unix_x86_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
<NativeRuntimeAsset Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_unix_arm_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
<NativeRuntimeAsset Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_x64_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
<NativeRuntimeAsset Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)$(LibPrefix)clrjit_win_arm64_$(TargetArchitecture)$(LibSuffix)" TargetPath="tools/" />
--
2.25.1

0 comments on commit 1cadc41

Please sign in to comment.