Skip to content
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 5 commits into from
Jan 17, 2023

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jan 4, 2023

@janvorli @MichaelSimons PTAL. I can't seem to add reviewers directly.

This is adding an Ubuntu 20.04 image with an arm64 Ubuntu 16.04 rootfs that we can use to build against a lower glibc version than we currently support. The plan is to use this image at least for the .NET 7 part of dotnet/runtime#69361.

Locally, I've used these steps to build a container that can build coreclr with the --pgoinstrument argument. Without the profile library build, the build fails with

ld.lld: error: cannot open /rootfs/usr/lib/llvm-9/lib/clang/9.0.1/lib/linux/libclang_rt.profile-aarch64.a: No such file or directory

Building this library and copying it into the rootfs fixes this.

@janvorli I would appreciate if you could also review the logs here to make sure everything looks ok: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/build/builds/137325/logs/467. I started with instructions at https://llvm.org/docs/HowToCrossCompileLLVM.html and https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html, then had to play around with the arguments and use a mix of CMAKE variables and flags like --sysroot (-DCMAKE_SYSROOT was not working as I expected). The logs show that /usr/lib/llvm-9/lib/clang/9.0.1/include is still being used as an include path - I am not sure if this is a problem, so I'd appreciate your eyes on this.

@sbomer sbomer changed the title Target Ubuntu 16.04 in arm64 cross-build images Add arm64 cross-build images targeting Ubuntu 16.04 Jan 13, 2023
@sbomer sbomer marked this pull request as ready for review January 14, 2023 00:56
src/ubuntu/20.04/cross/arm64/Dockerfile Outdated Show resolved Hide resolved
src/ubuntu/20.04/cross/arm64/Dockerfile Outdated Show resolved Hide resolved
@janvorli
Copy link
Member

The logs show that /usr/lib/llvm-9/lib/clang/9.0.1/include is still being used as an include path

The same happens for .NET crossbuild, so it is ok. It seems like these are compiler internal headers for intrinsics and few other things.

@@ -119,6 +119,8 @@ A precondition for building an image is to ensure that the base image specified

In certain cases, it is necessary to run custom logic before and after the Dockerfiles are built. For example, to build the Dockerfiles that are used for cross-gen builds, the rootfs that gets copied into the Docker image needs to be built on the host OS. To support these scenarios a `pre-build` or `post-build` bash or PowerShell script can be placed in a `hooks` folder next to the Dockerfile. The scripts will get invoked by the build process.

Note that multi-stage docker builds can be used to accomplish the same without build hooks, and are easier to iterate on locally because this takes advantage of docker image caching to avoid re-running steps when nothing has changed (whereas pre-build hooks run every time the dockerfile is built).
Copy link
Member

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.

src/ubuntu/20.04/cross/arm64/Dockerfile Outdated Show resolved Hide resolved
- Remove redundant toolchain option
- Rename to BUILD_CXX_FLAGS
- Indent cmake arguments
@sbomer sbomer requested a review from janvorli January 17, 2023 18:21
@sbomer
Copy link
Member Author

sbomer commented Jan 17, 2023

@mthalman @MichaelSimons would you mind merging this? I don't have permission. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants