-
Notifications
You must be signed in to change notification settings - Fork 8
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
Build native image for Linux aarch64 #1
Conversation
- os: macOS-latest | ||
uploaded_filename: sbtn-x86_64-apple-darwin | ||
local_path: client/target/bin/sbtn | ||
- os: ubuntu-latest | ||
uploaded_filename: sbtn-x86_64-pc-linux | ||
local_path: client/target/bin/sbtn | ||
- os: ubuntu-22.04 | ||
uploaded_filename: sbtn-aarch64-pc-linux | ||
local_path: client/target/bin/sbtn |
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.
ubuntu-22.04
and ubuntu-latest
refer to the same image.
However, adding ubuntu-22.04
is just a stupid workaround so we kick off a extra job that generates us the aarch64 binary.
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.
You could add jobtype like https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html#Build+matrix
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.
Hmm.. I thought I tried that, but it didn't work immediately, so I just use the now merged approach... Anyway, not so important I guess.
@@ -31,6 +33,7 @@ jobs: | |||
uses: actions/checkout@v3 | |||
with: | |||
repository: sbt/sbt | |||
ref: 1.8.x |
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.
@eed3si9n I think it would be a good idea to define the branch here. Like now I would like to use the current stable sbt branch (1.8.x).
Would it make sense to introduce a 1.8.x and 1.9.x branch here in the sbt/sbtn-dist repository as well, which refer to the according sbt branch in its native.yml
? And even remove the develop
branch?
What do you think?
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.
Yea, thus far I've only had to build sbtn for fresh new minor releases, so assuming the default branch has been ok.
#apt-get update -q && apt-get install -q -y sbt | ||
# Workaround: | ||
curl -Ls https://scala.jfrog.io/artifactory/debian/sbt-1.8.0.deb -o sbt-1.8.0.deb | ||
apt install -y ./sbt-1.8.0.deb |
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.
Another alternative to install sbt
inside this QEMU virtual machine would be to use sdkman:
curl -s "https://get.sdkman.io" | bash
source "/root/.sdkman/bin/sdkman-init.sh"
sdk install sbt
We could also use coursier, like seen in the scala-ci or coursier repo... However I didn't do that since coursier does not publish a aarch64 64k page-size compatible binary yet (but soon 😉), so I couldn't test that locally on my machine... (It should work in the CI virtual machine though)
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.
So that's why it is necessary to run the GraalVM on the system you want to build a binary for. So it seems the only viable workaround is to make use of https://github.com/uraimo/run-on-arch-action.
That's amazing. I didn't know such magic was possible.
(The workflows from this pull request need to re-run afterwards)
It's not possible to cross compile with
native-image
currently, not even for a different architecture on the same OS (like x86_64 -> aarch64 in Linux; unlike gcc where you could just installgcc-aarch64-linux-gnu
), seeSo that's why it is necessary to run the GraalVM on the system you want to build a binary for. So it seems the only viable workaround is to make use of https://github.com/uraimo/run-on-arch-action. That is what
As a result of this PR, you can download the aarch64 artifact here in my fork already: https://github.com/mkurz/sbtn-dist/actions/runs/3825630367
Eventually, this PR is needed to fix
sbtn
on aarch64 Linux fails sbt#7095 and