Conversation
Detects the arch from the "TARGET_CONTAINER_BUILD_ARCH" build-arg and only installs the needed packages for the specific arch. Removes apt cache to reduce layer size. Separate "RUN" commands are used to create multiple layers that can be later re-used.
Some builders, specifically rootless podman, can throw a warning due to insufficient access to /dev/pts. This is not critical as it is only a warning, it is still better to pass that flag to avoid those warnings. The "~" symbol is not always properly expanded in Dockerfile, it is better to use the full path.
Uses "TARGET_CONTAINER_PLATFORM" build-arg to determine the arch and only installed requried packages. Removed apt cache to reduce layer size and separated the build into multiple layers that can be reused later.
Forces the container to be emulated to a specific platform, this ensures conan profile has the required arch set properly. This does have a performance penalty since all instructions are emulated. Determines the container platform based on CPU name passed as "TARGET_BUILD_ARCH", only armv8 is recognized as ARM64 (armv8_32 is broken either way), in the future this script may need to manually allow newer ARM CPUs, for now everything unknown is marked as "arm32".
Turns out if you compile a binary for x86_64, then you also need those libraries. To preserve compatibility with i386, it is best to just install i386 related libraries also on 64-bit images too.
This is needed for the announce mechanism to work, it may not be included because of "--no-install-recommends".
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently you can only pass "TARGET_BUILD_ARCH" to specify the omp-server binary files' arch, the script passes this flag to the building container and then conan uses this flag to build the binaries. The problem is that conan does not properly set the profile for the selected arch as a result bulding the binaries can fail.
The solution is simple: use the container runtime's built-in feature to emulate the required arch. This way we can get consistent builds across multiple arches (specifically x86_64 can now build binaries for armv7 and armv8).
As a bonus, the runtime container that runs the binaries can now also be ran with a specific arch.
I did not include the following PR, it is still needed for AMD64 containers:
#1263