Repository navigation
build: link libatomic on Linux static builds - #39
Merged
Merged
Conversation
The perf prebuilt archive references __atomic_compare_exchange from the buffer manager's 16-byte atomics, and nothing on the link line provides it, so LBUG_LINUX_VARIANT=perf fails to link. Link libatomic alongside libstdc++; with --as-needed, compat builds are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #38.
The perf prebuilt archive on Linux calls
__atomic_compare_exchangefor the 16-byte atomics in the buffer manager, and nothing on the link line provides it. SoLBUG_LINUX_VARIANT=perffails at the final link. This addslibatomicnext tolibstdc++for Linux static builds.Rust passes
--as-neededto the linker, so if nothing calls into libatomic the binary doesn't end up depending on it. Compat builds come out exactly as before.Tested with engine v0.20.4 on Ubuntu 24.04:
NEEDEDlist as beforelibatomic.so.1inNEEDEDNEEDEDlist as beforecargo testpasses with both variants on aarch64. The perf link also works with gcc-14 as the linker. I couldn't run the x86_64 binaries on this machine, so on x86_64 that's link-only.I went with linking it for every Linux static build rather than only for perf, since it costs nothing when unused and also covers anyone pointing
LBUG_LIBRARY_DIRat a perf archive. Happy to narrow it to perf if you'd prefer.