-
Notifications
You must be signed in to change notification settings - Fork 497
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: Portable, fully-static release executables on Linux #1351
Merged
joeyparrish
merged 10 commits into
shaka-project:main
from
joeyparrish:fully-static-binaries
Feb 27, 2024
Merged
feat: Portable, fully-static release executables on Linux #1351
joeyparrish
merged 10 commits into
shaka-project:main
from
joeyparrish:fully-static-binaries
Feb 27, 2024
Commits on Feb 26, 2024
-
feat: Portable, fully-static release executables on Linux
This adds the option FULLY_STATIC to create fully-static executables. To create portable, fully-static release executables on Linux, we need to use musl instead of glibc. Static executables from glibc are not portable. The popular musl-gcc wrapper does not support C++, so instead we use a full musl cross-compiler toolchain in the build workflow. To build FULLY_STATIC, the user must point to the appropriate cross-compiler, as we do in the workflow. On systems where musl is the native libc (such as Alpine Linux), this is not necessary. I have also read that musl's allocator is not very fast in multi-threaded applications. So when FULLY_STATIC is enabled, we will also enable mimalloc, a replacement allocator that is very fast. I tested a very basic packaging command to compare speeds of dynamic glibc, static musl, and static musl+mimalloc: dynamic glibc: runs: 2.527, 2.798, 2.703, 2.756, 2.959 avg = 2.749, std dev = 0.156s static musl: runs: 2.813, 2.920, 3.129, 3.003, 2.738 avg = 2.921s, std dev = 0.154s static musl+mimalloc: runs: 2.291, 2.034, 2.415, 2.303, 2.265 avg = 2.262s, std dev = 0.140s The mimalloc build is 82% faster than musl default allocator, 77% faster than glibc, and has more consistent runtime characteristics (lower standard deviation).
Configuration menu - View commit details
-
Copy full SHA for 6981ecb - Browse repository at this point
Copy the full SHA 6981ecbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 798e676 - Browse repository at this point
Copy the full SHA 798e676View commit details
Commits on Feb 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 6afcff6 - Browse repository at this point
Copy the full SHA 6afcff6View commit details -
Configuration menu - View commit details
-
Copy full SHA for c095b69 - Browse repository at this point
Copy the full SHA c095b69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 61a31a0 - Browse repository at this point
Copy the full SHA 61a31a0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7494440 - Browse repository at this point
Copy the full SHA 7494440View commit details -
Configuration menu - View commit details
-
Copy full SHA for e81bab7 - Browse repository at this point
Copy the full SHA e81bab7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f708e7 - Browse repository at this point
Copy the full SHA 4f708e7View commit details -
Configuration menu - View commit details
-
Copy full SHA for fa6ee34 - Browse repository at this point
Copy the full SHA fa6ee34View commit details -
Another attempt to verify static executables
ldd does not return exit code of 1 any more for static, and "file" reports dynamic on arm64 even when it is not. So now we look at the output of ldd instead.
Configuration menu - View commit details
-
Copy full SHA for cda33a1 - Browse repository at this point
Copy the full SHA cda33a1View commit details
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.