-
Notifications
You must be signed in to change notification settings - Fork 14
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
[STAL-2781] Build release Linux binary on Ubuntu 20.04 #516
Conversation
Special thanks to @robertohuertasm for debugging this and identifying the solution |
Thank you @jasonforal for your nice words ❤️ and for your thorough work on this issue 🙌🏻 . It's always a pleasure to collaborate with you! |
chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
apt-get update | ||
apt-get install gh -y |
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.
Why do we need this?
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.
The gh
CLI is needed to upload the artifact. A vanilla Ubuntu image doesn't come with this pre-installed
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
apt-get update | ||
apt-get install gh -y | ||
git config --global --add safe.directory $GITHUB_WORKSPACE |
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.
Why this too?
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.
Same story -- Github's runners automatically have this configured, but that doesn't apply to a vanilla Ubuntu image. Without this, the job fails because of git throwing an unsafe repository error
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.
The code was released before for ubuntu 22.04 and we are now building for 20.04. Does it still work on 22.04?
Yes, for the APIs we're using, newer versions of glibc have backwards-compatibility. So it works on 22.04, 24.04, etc. |
505d2e5
to
2a3a947
Compare
What problem are you trying to solve?
We currently compile our Linux release binaries on GitHub's
ubuntu-latest
runner, which resolves to ubuntu 24.04. Because 24.04 uses a newer version of glibc, it compiles binaries that expect more recent versions of glibc (currently, v8 expectspthread_getattr_np@GLIBC_2.32
). This leads to an error when trying to run the binary on older versions of Linux (specifically Ubuntu 20.04, which ships with glibc 2.31)What is your solution?
Building on Ubuntu 20.04 generates a binary that now expects glibc 2.2.5:
❯ greadelf -a datadog-static-analyzer-server | grep pthread_getattr_np 000003efe688 011700000006 R_X86_64_GLOB_DAT 0000000000000000 pthread_getattr_np@GLIBC_2.2.5 + 0
And thus the binaries now work on Ubuntu 20.04.
You can confirm that this modification to the release workflow functions correctly by looking at a pre-release that I just generated to test it:
We need to add an extra step to set up the container, as the base image is missing the packages that GitHub installs by default on a non-containerized runner (curl, gh, etc).
Alternatives considered
What the reviewer should know
ubuntu-latest
(currently 24.04). Assuming glibc doesn't have forward-compatibility issues, this setup is fine.