Skip to content

Commit

Permalink
add FreeBSD build (#34521)
Browse files Browse the repository at this point in the history
* try to add FreeBSD to the build

* s/FreeBSD/FReeBSD_x64

* more fixes to pass -os FreeBSD

* add missing :

* more fixes and feedback from review

* pull in new container

* fix corelib-nativecorelib-tools-packages as well

* add crossrootfsDir

* pass crossrootfsDir

* fix installr

* fix compilation on freebsd

* fix test build on freebsd

* update to match new layout

* fix native tests

* CrossBuild?

* rootfsDir debug

* merge with linux to get container support

* fix proc_maps

* fix up buildCommandSourcesDirectory

* remove debug

* more fixup for buildCommandSourcesDirectory

* use TargetOS instead of os

* remove old section

* rever changes to get_loaded_library_from_proc_maps

* fix compilation with missing getline

* add official build

* use arch

* remove special pool for freebsd

* roll-back runtime-official.yml

Co-authored-by: Tomas Weinfurt <[email protected]>
Co-authored-by: Tomas Weinfurt <[email protected]>
  • Loading branch information
3 people authored Apr 18, 2020
1 parent dd339fe commit 445e2f1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 50 deletions.
36 changes: 19 additions & 17 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,25 @@ jobs:
${{ insert }}: ${{ parameters.jobParameters }}

# FreeBSD

# FreeBSD machines are currently offline. Re-enable in the official build when
# the machines are healthy.

# - template: xplat-setup.yml
# parameters:
# jobTemplate: ${{ parameters.jobTemplate }}
# osGroup: FreeBSD
# archType: x64
# jobParameters:
# runtimeFlavor: ${{ parameters.runtimeFlavor }}
# buildConfig: ${{ parameters.buildConfig }}
# # There are no FreeBSD helix queues, so we don't run tests at the moment.
# helixQueues:
# asString: ''
# asArray: []
# ${{ insert }}: ${{ parameters.jobParameters }}
- ${{ if containsValue(parameters.platforms, 'FreeBSD_x64') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
osGroup: FreeBSD
archType: x64
platform: FreeBSD_x64
container:
image: ubuntu-18.04-cross-freebsd-11-20200407092345-a84b0d2
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
buildConfig: ${{ parameters.buildConfig }}
helixQueueGroup: ${{ parameters.helixQueueGroup }}
crossrootfsDir: '/crossrootfs/x64'
${{ if eq(parameters.passPlatforms, true) }}:
platforms: ${{ parameters.platforms }}
${{ insert }}: ${{ parameters.jobParameters }}

# Android x64

Expand Down
4 changes: 0 additions & 4 deletions eng/pipelines/common/xplat-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ jobs:
name: NetCoreInternal-Pool
queue: BuildPool.Ubuntu.1604.Amd64

# FreeBSD builds only in the internal project
${{ if and(eq(parameters.osGroup, 'FreeBSD'), ne(variables['System.TeamProject'], 'public')) }}:
name: dnceng-freebsd-internal

# Public OSX Build Pool
${{ if eq(parameters.osGroup, 'OSX') }}:
vmImage: 'macOS-10.14'
Expand Down
10 changes: 3 additions & 7 deletions eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ jobs:
- ${{ if and(ne(parameters.osGroup, 'Windows_NT'), eq(parameters.compilerName, 'clang')) }}:
- name: compilerArg
value: '-clang9'
# Our FreeBSD doesn't yet detect available clang versions, so pass it explicitly.
- ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
- name: compilerArg
value: '-clang6.0'
# Building for x64 MUSL happens on Alpine Linux and we need to use the stable version available there
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64')) }}:
- name: compilerArg
Expand Down Expand Up @@ -128,7 +124,7 @@ jobs:

# Build CoreCLR Runtime
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
- script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) $(officialBuildIdArg)
- script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(officialBuildIdArg)
displayName: Build CoreCLR Runtime
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- script: set __TestIntermediateDir=int&&$(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(officialBuildIdArg)
Expand All @@ -139,11 +135,11 @@ jobs:
displayName: Build Cross OS Linux DAC for Windows

# Build CoreCLR Managed Components
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages

# Build native test components
- script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(compilerArg) skipgeneratelayout
- script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(osArg) $(priorityArg) $(compilerArg) skipgeneratelayout
displayName: Build native test components

# Sign on Windows
Expand Down
7 changes: 7 additions & 0 deletions eng/pipelines/coreclr/templates/xplat-pipeline-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,11 @@ jobs:
- ${{ each variable in parameters.variables }}:
- ${{insert}}: ${{ variable }}

- name: osArg
value: ''

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

steps: ${{ parameters.steps }}
11 changes: 4 additions & 7 deletions eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ jobs:
value: /p:OfficialBuildId=$(Build.BuildNumber)

- name: buildCommandSourcesDirectory
${{ if ne(parameters.osGroup, 'Linux') }}:
${{ if not(in(parameters.osGroup, 'Linux', 'FreeBSD')) }}:
value: '$(Build.SourcesDirectory)/'
# This job runs within Docker containers, so Build.SourcesDirectory is not accurate.
${{ if eq(parameters.osGroup, 'Linux') }}:
${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
value: '/root/runtime/'

###
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if eq(parameters.osGroup, 'Linux') }}:
- ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:

# Preserve the NuGet authentication env vars into the Docker container.
# The 'NuGetAuthenticate' build step may have set these.
Expand All @@ -167,10 +167,6 @@ jobs:
-e ROOTFS_DIR=${{ parameters.crossrootfsDir }}
${{ parameters.container }}
- ${{ if eq(parameters.name, 'FreeBSD_x64') }}:
- name: RunArguments
value: export DotNetBootstrapCliTarPath=/dotnet-sdk-freebsd-x64.tar &&

- name: BuildScript
value: ./build.sh
- name: MSBuildScript
Expand All @@ -185,6 +181,7 @@ jobs:
- name: CommonMSBuildArgs
value: >-
/p:Configuration=$(_BuildConfig)
/p:TargetOS=${{ parameters.osGroup }}
/p:TargetArchitecture=${{ parameters.archType }}
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
$(OfficialBuildArg)
Expand Down
18 changes: 3 additions & 15 deletions eng/pipelines/libraries/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- ${{ if ne(parameters.testScope, '') }}:
- _testScopeArg: -testscope ${{ parameters.testScope }}

- ${{ if eq(parameters.osGroup, 'Linux') }}:
- ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
- _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}

- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}:
Expand All @@ -63,20 +63,8 @@ jobs:
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, ''), eq(parameters.archType, 'arm')) }}:
- _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04

# force a value for OS when cross-building WebAssembly
- ${{ if eq(parameters.osGroup, 'WebAssembly') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

# force a value for OS when cross-building tvOS on OSX
- ${{ if eq(parameters.osGroup, 'tvOS') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

# force a value for OS when cross-building iOS on OSX
- ${{ if eq(parameters.osGroup, 'iOS') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

# force a value for OS when cross-building Android on Linux
- ${{ if eq(parameters.osGroup, 'Android') }}:
# force a value for OS when cross-building
- ${{ if in(parameters.osGroup, 'WebAssembly', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}

- ${{ if ne(parameters.framework, '') }}:
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ jobs:
- Windows_NT_x86
- Windows_NT_arm
- Windows_NT_arm64
- FreeBSD_x64
jobParameters:
testGroup: innerloop

Expand Down Expand Up @@ -380,6 +381,7 @@ jobs:
- Linux_x64
- OSX_x64
- Windows_NT_x64
- FreeBSD_x64
jobParameters:
liveRuntimeBuildConfig: release

Expand Down Expand Up @@ -494,6 +496,7 @@ jobs:
- Linux_arm64
- Linux_musl_x64
- Windows_NT_x64
- FreeBSD_x64
jobParameters:
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
Expand Down
4 changes: 4 additions & 0 deletions src/installer/corehost/cli/hostmisc/pal.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if defined(TARGET_FREEBSD)
#define _WITH_GETLINE
#endif

#include "pal.h"
#include "utils.h"
#include "trace.h"
Expand Down

0 comments on commit 445e2f1

Please sign in to comment.