Skip to content

Commit

Permalink
Remove Hostx86/arm CrossGen from building and Simplify build.sh comma…
Browse files Browse the repository at this point in the history
…nd line arguments for Linux/arm cross build (Part 2) (dotnet#21034)

* Stop building and publishing Hostx86/arm crossgen on Linux/arm

* Remove -crosscomponent argument and stop using CAC_ROOTFS_DIR environment variable in build.sh

* Simplify the related logic in build.sh

* Don't need to specify crosscomponent in tests/scripts/run-pmi-diffs.py

* Don't set CAC_ROOTFS_DIR in buildpipeline, Jenkins files and in tests/scripts/run-pmi-diffs.py

* Adjust documentation
  • Loading branch information
echesakov committed Dec 3, 2018
1 parent a089f64 commit 20c6bc5
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Documentation/building/linux-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The CI system and official builds use Docker to build ARM for Linux (for example

```
ROOT=/Users/me/git/coreclr
DOCKER_ARGS="run -i --rm -v ${ROOT}:/mnt/coreclr -w /mnt/coreclr -e ROOTFS_DIR=/crossrootfs/arm -e CAC_ROOTFS_DIR=/crossrootfs/x86 microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
DOCKER_ARGS="run -i --rm -v ${ROOT}:/mnt/coreclr -w /mnt/coreclr -e ROOTFS_DIR=/crossrootfs/arm microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
docker ${DOCKER_ARGS} /mnt/coreclr/build.sh arm checked cross
docker ${DOCKER_ARGS} /mnt/coreclr/build-test.sh arm checked cross generatelayoutonly
```
Expand Down
51 changes: 7 additions & 44 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ if [ "$PYTHON" == "" ] ; then
exit 1
fi
fi

# validate python-dependency
# useful in case of explicitly set option.
if ! command -v $PYTHON > /dev/null
Expand Down Expand Up @@ -337,57 +336,31 @@ build_native()

build_cross_architecture_components()
{
local crossArch="$1"

local intermediatesForBuild="$__IntermediatesDir/Host$crossArch/crossgen"
local crossArchBinDir="$__BinDir/$crossArch"
local intermediatesForBuild="$__IntermediatesDir/Host$__CrossArch/crossgen"
local crossArchBinDir="$__BinDir/$__CrossArch"

mkdir -p "$intermediatesForBuild"
mkdir -p "$crossArchBinDir"

generate_event_logging_sources "$intermediatesForBuild" "the crossarch build system"

__SkipCrossArchBuild=1
TARGET_ROOTFS=""
# check supported cross-architecture components host(__HostArch)/target(__BuildArch) pair
if [[ ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") && "$crossArch" == "x86" ]]; then
export CROSSCOMPILE=0
if [[ ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") && ("$__CrossArch" == "x86" || "$__CrossArch" == "x64") ]]; then
__SkipCrossArchBuild=0

# building x64-host/arm-target cross-architecture component need to use cross toolchain of x86
if [ "$__HostArch" == "x64" ]; then
export CROSSCOMPILE=1
fi
elif [[ ("$__BuildArch" == "arm64") && "$crossArch" == "x64" ]]; then
export CROSSCOMPILE=0
__SkipCrossArchBuild=0
elif [[ ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") && "$crossArch" == "x64" ]]; then
export CROSSCOMPILE=0
elif [[ "$__BuildArch" == "arm64" && "$__CrossArch" == "x64" ]]; then
__SkipCrossArchBuild=0
else
# not supported
return
fi

export __CMakeBinDir="$crossArchBinDir"
export CROSSCOMPONENT=1

if [ $CROSSCOMPILE == 1 ]; then
TARGET_ROOTFS="$ROOTFS_DIR"
if [ -n "$CAC_ROOTFS_DIR" ]; then
export ROOTFS_DIR="$CAC_ROOTFS_DIR"
else
export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__CrossArch"
fi
fi
export CROSSCOMPILE=0

__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_CROSS_COMPONENTS_BUILD=1"
build_native $__SkipCrossArchBuild "$crossArch" "$intermediatesForBuild" "$__ExtraCmakeArgs" "cross-architecture components"
build_native $__SkipCrossArchBuild "$__CrossArch" "$intermediatesForBuild" "$__ExtraCmakeArgs" "cross-architecture components"

# restore ROOTFS_DIR and CROSSCOMPILE
if [ -n "$TARGET_ROOTFS" ]; then
export ROOTFS_DIR="$TARGET_ROOTFS"
fi
export CROSSCOMPILE=1
}

Expand Down Expand Up @@ -840,11 +813,6 @@ while :; do
__SkipCoreCLR=1
;;

crosscomponent|-crosscomponent)
# Accept "crosscomponent" for backward-compatibility but ignore it.
echo "WARNING: 'crosscomponent' is obsolete and should not be used"
;;

skipmanaged|-skipmanaged)
__SkipManaged=1
;;
Expand Down Expand Up @@ -1049,12 +1017,7 @@ build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeA

# Build cross-architecture components
if [[ $__CrossBuild == 1 ]]; then
build_cross_architecture_components "$__CrossArch"

# For now, continue building Hostx86/arm crossgen
if [[ "$__HostArch" == "x64" && "$__BuildArch" == "arm" ]]; then
build_cross_architecture_components "x86"
fi
build_cross_architecture_components
fi

# Build System.Private.CoreLib.
Expand Down
6 changes: 1 addition & 5 deletions buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
},
"inputs": {
"filename": "docker",
"arguments": "run --rm -e ROOTFS_DIR=$(ROOTFS_DIR) -e CAC_ROOTFS_DIR=$(CAC_ROOTFS_DIR) $(DockerCommonRunArgs) ./build.sh $(PB_BuildType) $(Architecture) skipnuget cross -skiprestore stripSymbols -OfficialBuildId=$(OfficialBuildId) -- /flp:\"v=diag\"",
"arguments": "run --rm -e ROOTFS_DIR=$(ROOTFS_DIR) $(DockerCommonRunArgs) ./build.sh $(PB_BuildType) $(Architecture) skipnuget cross -skiprestore stripSymbols -OfficialBuildId=$(OfficialBuildId) -- /flp:\"v=diag\"",
"workingFolder": "",
"failOnStandardError": "false"
}
Expand Down Expand Up @@ -520,10 +520,6 @@
"ROOTFS_DIR": {
"value": "/crossrootfs/$(Architecture)"
},
"CAC_ROOTFS_DIR": {
"value": "",
"allowOverride": true
},
"DockerVolumeName": {
"value": "coreclr-cross-$(Build.BuildId)"
},
Expand Down
4 changes: 1 addition & 3 deletions buildpipeline/pipelines.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@
"DockerTag": "ubuntu-14.04-cross-e435274-20180426002420",
"Architecture": "arm",
"Rid": "linux",
"CrossArchitecture": "x86",
"CrossArchBuildPackagesArgs": "-__DoCrossArchBuild=1",
"CAC_ROOTFS_DIR": "/crossrootfs/$(CrossArchitecture)"
"CrossArchBuildPackagesArgs": "-__DoCrossArchBuild=1"
},
"ReportingParameters": {
"OperatingSystem": "Linux",
Expand Down
2 changes: 0 additions & 2 deletions dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm64'">x64</CrossTargetComponentFolder>
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm' and '$(TargetsWindows)' == 'true'">x86</CrossTargetComponentFolder>
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm' and '$(TargetsLinux)' == 'true'">x64</CrossTargetComponentFolder>
<_HasObsoleteCrossTargetComponents Condition="'$(TargetsLinux)' == 'true' and '$(PackagePlatform)' =='arm' and '$(__DoCrossArchBuild)' == '1'">true</_HasObsoleteCrossTargetComponents>
<_ObsoleteCrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm'">x86</_ObsoleteCrossTargetComponentFolder>

<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(PackagesBinDir)/pkg/</PackageOutputPath>
<SymbolPackageOutputPath Condition="'$(SymbolPackageOutputPath)' == ''">$(PackagesBinDir)/symbolpkg/</SymbolPackageOutputPath>
Expand Down
7 changes: 1 addition & 6 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2508,19 +2508,14 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
// Add some useful information to the log file. Ignore return codes.
buildCommands += "uname -a || true"

def additionalOpts = ""
if (architecture == 'arm') {
additionalOpts = "-e CAC_ROOTFS_DIR=/crossrootfs/x86"
}

// Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
// Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
// For CoreFX testing, we only need the product build; we don't need to generate the layouts. The product
// build is then copied into the corefx layout by the run-corefx-test.py script. For CoreFX testing, we
// ZIP up the generated CoreFX runtime and tests.

def dockerImage = getDockerImageName(architecture, os, true)
def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${additionalOpts} ${dockerImage} "
def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${dockerImage} "

buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"

Expand Down
3 changes: 1 addition & 2 deletions perf.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ def static getFullThroughputJobName(def project, def os, def arch, def isPR) {
python = "python3.6"
def buildCommands = []
def newBuildJob = job(fullBuildJobName) {
def additionalOpts = "-e CAC_ROOTFS_DIR=/crossrootfs/x86"
def dockerImage = getDockerImageName(architecture, 'Ubuntu', true)
def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${additionalOpts} ${dockerImage} "
def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/${architecture} ${dockerImage} "

buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh release ${architecture} cross"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
<ItemGroup>
<NativeBinary Include="$(BinDir)libclrjit.so" />
<CrossArchitectureSpecificNativeFileAndSymbol Condition="'$(HasCrossTargetComponents)' == 'true'" Include="$(BinDir)$(CrossTargetComponentFolder)\libclrjit.so" />
<_ObsoleteCrossArchitectureSpecificNativeFileAndSymbol Condition="'$(_HasObsoleteCrossTargetComponents)' == 'true'" Include="$(BinDir)$(_ObsoleteCrossTargetComponentFolder)\libclrjit.so" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
<ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
<CrossArchitectureSpecificToolFile Condition="'$(HasCrossTargetComponents)' == 'true'" Include="$(BinDir)$(CrossTargetComponentFolder)\crossgen" />
<_ObsoleteCrossArchitectureSpecificToolFile Condition="'$(_HasObsoleteCrossTargetComponents)' == 'true'" Include="$(BinDir)$(_ObsoleteCrossTargetComponentFolder)\crossgen" />
</ItemGroup>
</Project>
9 changes: 0 additions & 9 deletions src/.nuget/dir.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@
</NativeWithSymbolFile>
</ItemGroup>

<ItemGroup Condition="'$(_HasObsoleteCrossTargetComponents)'=='true'">
<NativeWithSymbolFile Include="@(_ObsoleteCrossArchitectureSpecificNativeFileAndSymbol)">
<TargetPath>runtimes/$(_ObsoleteCrossTargetComponentFolder)_$(Platform)/native</TargetPath>
</NativeWithSymbolFile>
<NativeWithSymbolFile Include="@(_ObsoleteCrossArchitectureSpecificToolFile)">
<TargetPath>tools/$(_ObsoleteCrossTargetComponentFolder)_$(Platform)</TargetPath>
</NativeWithSymbolFile>
</ItemGroup>

<ItemGroup>
<!-- The symbols for these files are already in place together with respective *.ni.pdb -->
<IlForCrossGenedFile Include="@(CrossGenBinary -> '%(RootDir)%(Directory)IL\%(Filename).dll')">
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/run-pmi-diffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# The Docker file and possibly options should be hoisted out to a text file to be shared between scripts.

Docker_name_arm32 = 'microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420'
Docker_opts_arm32 = '-e ROOTFS_DIR=/crossrootfs/arm -e CAC_ROOTFS_DIR=/crossrootfs/x86'
Docker_opts_arm32 = '-e ROOTFS_DIR=/crossrootfs/arm'

Docker_name_arm64 = 'microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921'
Docker_opts_arm64 = '-e ROOTFS_DIR=/crossrootfs/arm64'
Expand Down Expand Up @@ -313,7 +313,7 @@ def baseline_build():
dockerOpts = Docker_opts_arm64

dockerCmd = 'docker run -i --rm -v %s:%s -w %s %s %s ' % (baseCoreClrPath, baseCoreClrPath, baseCoreClrPath, dockerOpts, dockerFile)
buildOpts = 'cross crosscomponent'
buildOpts = 'cross'
scriptPath = baseCoreClrPath

# Build a checked baseline jit
Expand Down

0 comments on commit 20c6bc5

Please sign in to comment.