-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add arm64 cross-build images targeting Ubuntu 16.04 #754
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f3bba23
Target Ubuntu 16.04 in arm64 cross-build images
sbomer 94f105a
Revert "Target Ubuntu 16.04 in arm64 cross-build images"
sbomer f2f25ff
Build llvm-9 profile library for 16.04 arm64
sbomer fdd4dbc
PR feedback
sbomer 20f5770
Rename common build flags to BUILD_FLAGS
sbomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-crossdeps-local AS binutils | ||
|
||
# Install binutils-aarch64-linux-gnu | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
binutils-aarch64-linux-gnu \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
FROM binutils AS rootfsbuild | ||
ARG ROOTFS_DIR=/crossrootfs | ||
|
||
# Build rootfs | ||
RUN git config --global user.email builder@dotnet-buildtools-prereqs-docker && \ | ||
git clone --depth 1 --single-branch https://github.com/dotnet/arcade /scripts | ||
RUN /scripts/eng/common/cross/build-rootfs.sh arm64 xenial lldb3.9 --skipunmount | ||
RUN bash -c "rm -rf $ROOTFS_DIR/*/{var/cache/apt/archives/*,var/lib/apt/lists/*,usr/share/doc,usr/share/man}" | ||
|
||
# Build llvm-9 compiler-rt profile library for arm64, for PGO support | ||
RUN wget https://github.com/llvm/llvm-project/releases/download/llvmorg-9.0.1/compiler-rt-9.0.1.src.tar.xz | ||
RUN tar -xf compiler-rt-9.0.1.src.tar.xz && \ | ||
rm compiler-rt-9.0.1.src.tar.xz | ||
RUN mkdir compiler-rt-build && \ | ||
cd compiler-rt-build && \ | ||
\ | ||
TARGET_TRIPLE=aarch64-linux-gnu \ | ||
BUILD_C_FLAGS="-v --sysroot=$ROOTFS_DIR" && \ | ||
\ | ||
cmake ../compiler-rt-9.0.1.src \ | ||
-DCOMPILER_RT_BUILD_PROFILE=ON \ | ||
-DCOMPILER_RT_BUILD_BUILTINS=OFF \ | ||
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \ | ||
-DCOMPILER_RT_BUILD_XRAY=OFF \ | ||
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ | ||
\ | ||
-DCMAKE_C_COMPILER=/usr/bin/clang-9 \ | ||
-DCMAKE_CXX_COMPILER=/usr/bin/clang++-9 \ | ||
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \ | ||
-DCMAKE_C_COMPILER_TARGET="${TARGET_TRIPLE}" \ | ||
-DCMAKE_CXX_COMPILER_TARGET="${TARGET_TRIPLE}" \ | ||
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \ | ||
-DLLVM_CONFIG_PATH=/usr/bin/llvm-config-9 \ | ||
\ | ||
-DCMAKE_C_FLAGS="${BUILD_C_FLAGS}" \ | ||
-DCMAKE_CXX_FLAGS="${BUILD_C_FLAGS}" \ | ||
sbomer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-DCMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN="$ROOTFS_DIR/usr" | ||
sbomer marked this conversation as resolved.
Show resolved
Hide resolved
sbomer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
RUN cd compiler-rt-build && make | ||
|
||
# Copy profile library to the rootfs | ||
RUN mkdir -p $ROOTFS_DIR/usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/ && \ | ||
cp /compiler-rt-build/lib/linux/libclang_rt.profile-aarch64.a $ROOTFS_DIR/usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/ | ||
|
||
|
||
FROM binutils | ||
ARG ROOTFS_DIR=/crossrootfs | ||
COPY --from=rootfsbuild $ROOTFS_DIR $ROOTFS_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. Hadn't looked closely at the original implementation to see that this could be improved. It was implemented before multi-stage Dockerfiles were even supported.