-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: Build with Alpine for static Linux binaries #42
Conversation
Here's a full CI run with the modified workflow: https://github.com/shaka-project/static-ffmpeg-binaries/actions/runs/11263885133 |
This uses an Alpine Linux container to build truly static Linux binaries that do not depend on glibc at runtime. Alpine uses musl instead of glibc, which enables this fully static build. With musl compiler wrappers in Ubuntu, you still end up importing glibc references through libstdc++. And since x265 uses C++, we can't eliminate these in Ubuntu without dropping HEVC support. Using Alpine, with its musl-native environment, allows us to avoid glibc and build fully static Linux binaries. Closes #28
ea95d76
to
7346baf
Compare
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.
A couple of questions inline.
Tested locally and works :)
LGTM!
# NOTE: disable OpenCL-based features because it uses dlopen and can interfere | ||
# with static builds. | ||
./configure \ | ||
--disable-opencl \ |
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.
Q, so builds with these configurations aren't static anymore or the does building fail all together?
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.
They aren't really static, since it uses dlopen to find OpenCL at runtime. Also, OpenCL isn't necessary for the H264 software codec.
container: | ||
image: ${{ matrix.container }} | ||
# Access to the host filesystem is required to patch the environment for | ||
# Alpine Linux support. See the first Alpine step below for details. |
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.
how things go when the matrix entry doesn't define a container? couldn't find it in github CI docs, but it seems to play nicely as we have green check marks on other platforms and the binaries are uploaded.
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 found that it just doesn't run in a container when image
is blank. So this works nicely with the build matrix, and allows us to put some builds in containers and others not.
This uses an Alpine Linux container to build truly static Linux binaries that do not depend on glibc at runtime.
Alpine uses musl instead of glibc, which enables this fully static build. With musl compiler wrappers in Ubuntu, you still end up importing glibc references through libstdc++. And since x265 uses C++, we can't eliminate these in Ubuntu without dropping HEVC support. Using Alpine, with its musl-native environment, allows us to avoid glibc and build fully static Linux binaries.
Closes #28