-
Notifications
You must be signed in to change notification settings - Fork 386
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
Support linux/arm64/v8
for most Ubuntu-based images
#1597
base: main
Are you sure you want to change the base?
Conversation
…-*` package on ubuntu
gfortran-aarch64-linux-gnu \ | ||
libc6-dev-arm64-cross | ||
ENV CROSS_TOOLCHAIN_PREFIX=aarch64-linux-gnu- | ||
ENV CROSS_SYSROOT=/usr/aarch64-linux-gnu |
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 decided to move these variable above apt-cross-essential.sh
, since I wanted to use CROSS_TOOLCHAIN_PREFIX
to test for pre-installed gfortran (which was causing some headaches).
docker/linux-image.sh
Outdated
@@ -156,7 +161,7 @@ main() { | |||
;; | |||
x86_64) | |||
arch=amd64 | |||
kernel="${kversion}-amd64" | |||
kernel="${kmajor}\.${kminor}\.${kpatch}-.*-amd64" |
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 don't know why, but apt was unable to find the original 5.10.0-26-amd64
package. Maybe it disappeared or something? Anyway, this fixed it and unblocked me
@@ -19,7 +19,7 @@ build_static_libffi () { | |||
tar --strip-components=1 -xzf "v${version}.tar.gz" | |||
./configure --prefix="$td"/lib --disable-builddir --disable-shared --enable-static | |||
make "-j$(nproc)" | |||
install -m 644 ./.libs/libffi.a /usr/lib64/ | |||
install -m 644 ./.libs/libffi.a /usr/local/lib/ |
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.
/usr/lib64
is not a thing on arm64
, so just use /usr/local/lib
instead. This potentially could cause issues with folks who building of their old Pentium 4's, but I'm not sure. Either way, I'd reckon it's a small subset of the userbase anyway.
This is awesome! Thank you, its all looking very good. We have a problem though with how to publish the arm64 images, I laid out a strategy in #849 but we could also use imagetools. We'd also probably want arm64 runners, but they are only available for team/enterprise orgs :/ The current ci wont set the platform correctly, itll also overwrite the uploaded images to not be multi-arch cross/.github/workflows/ci.yml Lines 185 to 195 in 4090bec
Ill have a look into this pr more closely |
Actually, not true, it should build but would overwrite, lets do a try :D cross/xtask/src/build_docker_image.rs Line 179 in 4090bec
/ci try --target aarch64-unknown-linux-gnu --target x86_64-unknown-linux-gnu |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Emilgardis Ok I think I see the issue, |
My (very limited) understanding was the |
/ci try --target aarch64-unknown-linux-gnu --target x86_64-unknown-linux-gnu |
@@ -424,7 +424,7 @@ EOF | |||
|
|||
# need to reinstall the removed libgcc packages, which are required for apt | |||
if [[ "${arch}" == "${dpkg_arch}" ]]; then | |||
apt-get install --no-install-recommends --assume-yes "${packages[@]}" | |||
apt-get install --no-install-recommends --assume-yes "${libgcc_packages[@]}" |
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 stumbled upon this... which I assumed to have been a typo since packages
is likely not defined (its only used for wildcard kernel image searches).
/ci try --target aarch64-unknown-linux-gnu --target x86_64-unknown-linux-gnu |
This comment has been minimized.
This comment has been minimized.
That sounds right, but it doesn't mean that both the amd64 and arm64/v8 images would be available, only the last built one would be tagged with what we want. |
Try run for comment
Successful Jobs |
I took a look, and I think 6428332 may do the trick. Basically, it just expands the matrix to include |
That works, but it doesnt change anything. It doesnt solve the problem of how to consolidate the two builds into one image |
Good point. If I'm understanding correctly, I see a couple of options for solving this:
Which would you prefer??? |
I have no preference, just want something that works. I've not heard of |
Thinking about this a bit more, using the multi value --platform would work for all images, except when target=host, as we want to then use |
Ok, I'll give the multi-platform string a whirl. The only thing I'm unsure about is if we need to supply the |
Dont think thats needed, i only see that the |
linux/arm64/v8
for most ubuntu-based imagedlinux/arm64/v8
for most Ubuntu-based image
linux/arm64/v8
for most Ubuntu-based imagelinux/arm64/v8
for most Ubuntu-based images
To clarify, you do want to use multiple platforms per job correct? Because before 6428332, we were only passing one platform (see here). If so, I can proceed with revert and work on passing multiple platforms per job afterwards. |
Interesting, that is not the intent of the code, it should build all passed platforms in one job per target in sequence. I don't think it's easy to do one job per target and platform, as we'd have to pass the built image somewhere else, however, as I mentioned here I think the most correct approach is publishing the image as |
22b36a4
to
6aec7b3
Compare
@Emilgardis If possible, I'd like to get this PR merged as is then we can handle the CI aspect of it as a follow up if you're OK with that. I'm struggling to figure out the best way to do it and I don't want to balloon the scope of this PR any more |
That's alright! The problem with merging it as is is that this will make people on aarch64 try to use an image that is not published. If you remove the changes to targets.toml and update provided_images.rs we can merge |
Previously, many images only provided
linux/amd64
builds, which meant that Apple silicon folks were left to Rosetta or qemu emulation when cross-compiling. Although Rosetta'sx86_64
emulation is a remarkable feat of engineering, nothing beats the performance of using thelinux/arm64/v8
on Apple silicon.This PR adds support to a bunch of Ubuntu-based images for
linux/arm64/v8
builds. I haven't been able to build all of them yet... mostly just tested thex86_64-unknown-linux-gnu
container. But I plan to squash any issues that arise from CI. Theoretically, it shouldn't be too hard since the core logic is the same across all images.New Platforms Supported
aarch64-unknown-linux-gnu
armv5te-unknown-linux-gnueabi
armv7-unknown-linux-gnueabi
i586-unknown-linux-gnu
i686-unknown-linux-gnu
mips-unknown-linux-gnu
mips64-unknown-linux-gnuabi64
mips64el-unknown-linux-gnuabi64
mipsel-unknown-linux-gnu
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
riscv64gc-unknown-linux-gnu
s390x-unknown-linux-gnu
sparc64-unknown-linux-gnu
thumbv7neon-unknown-linux-gnueabihf
x86_64-unknown-linux-gnu