Skip to content

Commit 2288685

Browse files
authored
Add mariner build images (#832)
1 parent c1673b9 commit 2288685

File tree

15 files changed

+772
-1
lines changed

15 files changed

+772
-1
lines changed

eng/pipelines/dotnet-buildtools-prereqs-mariner-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ stages:
2424
parameters:
2525
internalProjectName: ${{ variables.internalProjectName }}
2626
publicProjectName: ${{ variables.publicProjectName }}
27+
linuxAmdBuildJobTimeout: 360
28+
customBuildInitSteps:
29+
- template: /eng/pipelines/steps/install-cross-build-prereqs.yml

eng/pipelines/dotnet-buildtools-prereqs-mariner.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ stages:
2424
parameters:
2525
internalProjectName: ${{ variables.internalProjectName }}
2626
publicProjectName: ${{ variables.publicProjectName }}
27+
linuxAmdBuildJobTimeout: 360
28+
customBuildInitSteps:
29+
- template: /eng/pipelines/steps/install-cross-build-prereqs.yml

src/cbl-mariner/1.0/helix/amd64/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM cblmariner.azurecr.io/base/core:1.0
1+
FROM mcr.microsoft.com/cbl-mariner/base/core:1.0
22

33
# Install Helix Dependencies
44

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
ARG ROOTFS_DIR=/crossrootfs/x64
3+
4+
RUN /scripts/eng/common/cross/build-rootfs.sh x64 alpine3.13 --skipunmount
5+
6+
7+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-amd64-local
8+
ARG ROOTFS_DIR=/crossrootfs/x64
9+
10+
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
ARG ROOTFS_DIR=/crossrootfs/x64
3+
4+
RUN /scripts/eng/common/cross/build-rootfs.sh x64 xenial --skipunmount
5+
6+
7+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-amd64-local
8+
ARG ROOTFS_DIR=/crossrootfs/x64
9+
10+
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
11+
12+
RUN LLVM_VERSION=12.0.1 LLVM_VERSION_MAJOR="${LLVM_VERSION%%.*}" && \
13+
mkdir -p $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/ && \
14+
cp /usr/lib/clang/${LLVM_VERSION}/lib/linux/libclang_rt.profile-x86_64.a $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
ARG ROOTFS_DIR=/crossrootfs/arm64
3+
4+
RUN /scripts/eng/common/cross/build-rootfs.sh arm64 alpine3.13 --skipunmount
5+
6+
7+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-arm-local
8+
ARG ROOTFS_DIR=/crossrootfs/arm64
9+
10+
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
ARG ROOTFS_DIR=/crossrootfs/arm64
3+
4+
RUN /scripts/eng/common/cross/build-rootfs.sh arm64 xenial --skipunmount
5+
6+
# Build compiler-rt profile library for PGO instrumentation
7+
RUN mkdir compiler-rt_build && cd compiler-rt_build && \
8+
BUILD_FLAGS="-v --sysroot=$ROOTFS_DIR" \
9+
TARGET_TRIPLE=aarch64-linux-gnu && \
10+
cmake ../llvm-project.src/compiler-rt \
11+
-DCOMPILER_RT_BUILD_PROFILE=ON \
12+
-DCOMPILER_RT_BUILD_BUILTINS=OFF \
13+
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
14+
-DCOMPILER_RT_BUILD_XRAY=OFF \
15+
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
16+
\
17+
-DCMAKE_C_COMPILER=clang \
18+
-DCMAKE_CXX_COMPILER=clang++ \
19+
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
20+
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE} \
21+
-DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE} \
22+
-DLLVM_CONFIG_PATH=llvm-config \
23+
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
24+
-DCMAKE_BUILD_TYPE=Release \
25+
-DCMAKE_INSTALL_PREFIX=$ROOTFS_DIR/usr \
26+
-DCMAKE_C_FLAGS="${BUILD_FLAGS}" \
27+
-DCMAKE_CXX_FLAGS="${BUILD_FLAGS}" && \
28+
make -j $(getconf _NPROCESSORS_ONLN)
29+
30+
RUN LLVM_VERSION=12.0.1 LLVM_VERSION_MAJOR="${LLVM_VERSION%%.*}" && \
31+
mkdir -p $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/ && \
32+
cp compiler-rt_build/lib/linux/libclang_rt.profile-aarch64.a $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/
33+
34+
35+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-arm-local
36+
ARG ROOTFS_DIR=/crossrootfs/arm64
37+
38+
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
ARG ROOTFS_DIR=/crossrootfs/x86
3+
4+
# Provides LLVMConfig.cmake, needed to build compiler-rt. Only needed on x86.
5+
# x64 doesn't need this because we use compiler-rt from the mariner package.
6+
# arm/arm64 don't need this because LLVMConfig.cmake is provided by the LLVM we build from source.
7+
RUN tdnf install -y llvm-devel
8+
9+
RUN /scripts/eng/common/cross/build-rootfs.sh x86 xenial --skipunmount
10+
11+
# Build compiler-rt profile library for PGO instrumentation
12+
RUN mkdir compiler-rt_build && cd compiler-rt_build && \
13+
BUILD_FLAGS="-v --sysroot=$ROOTFS_DIR" \
14+
TARGET_TRIPLE=i386-linux-gnu && \
15+
cmake ../llvm-project.src/compiler-rt \
16+
-DCOMPILER_RT_BUILD_PROFILE=ON \
17+
-DCOMPILER_RT_BUILD_BUILTINS=OFF \
18+
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
19+
-DCOMPILER_RT_BUILD_XRAY=OFF \
20+
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
21+
\
22+
-DCMAKE_C_COMPILER=clang \
23+
-DCMAKE_CXX_COMPILER=clang++ \
24+
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
25+
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE} \
26+
-DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE} \
27+
-DLLVM_CONFIG_PATH=llvm-config \
28+
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
29+
-DCMAKE_BUILD_TYPE=Release \
30+
-DCMAKE_INSTALL_PREFIX=$ROOTFS_DIR/usr \
31+
-DCMAKE_C_FLAGS="${BUILD_FLAGS}" \
32+
-DCMAKE_CXX_FLAGS="${BUILD_FLAGS}" && \
33+
make -j $(getconf _NPROCESSORS_ONLN)
34+
35+
RUN LLVM_VERSION=12.0.1 LLVM_VERSION_MAJOR="${LLVM_VERSION%%.*}" && \
36+
mkdir -p $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/ && \
37+
cp compiler-rt_build/lib/linux/libclang_rt.profile-i386.a $ROOTFS_DIR/usr/lib/llvm-${LLVM_VERSION_MAJOR}/lib/clang/${LLVM_VERSION}/lib/linux/
38+
39+
40+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-amd64-local
41+
ARG ROOTFS_DIR=/crossrootfs/x86
42+
43+
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-local
2+
3+
RUN tdnf install -y \
4+
clang \
5+
lld \
6+
compiler-rt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-builder-local AS builder
2+
3+
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-crossdeps-local
4+
5+
# Install LLVM that we built from source
6+
COPY --from=builder /usr/local /usr/local

0 commit comments

Comments
 (0)