You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: the static perf variant fails to link on Linux (undefined __atomic_compare_exchange) #38
Ladybug version:lbug crate from main with engine v0.20.4 (LBUG_VERSION=0.20.4). I first hit it with the 0.19.1 crate and engine v0.20.0, and it has been the same on every release since.
OS: Ubuntu 24.04.5 LTS, x86_64. Also reproduces on aarch64.
What happened?
Setting LBUG_LINUX_VARIANT=perf makes the final link fail:
/usr/bin/ld: liblbug.a(buffer_manager.cpp.o): in function
`lbug::storage::EvictionQueue::insert(unsigned int, unsigned int)':
buffer_manager.cpp:(.text+0x66): undefined reference to `__atomic_compare_exchange'
... also in EvictionQueue::clear, EvictionQueue::tryClear,
BufferManager::pin, BufferManager::evictPages
collect2: error: ld returned 1 exit status
The perf archive has an undefined reference to __atomic_compare_exchange, and the compat archive doesn't. Same on both architectures in v0.20.4:
It comes from the 16-byte atomics in the buffer manager's eviction queue, which GCC turns into libatomic calls. build.rs links stdc++, ssl and crypto but not atomic, so nothing provides the symbol. Compat is the default, which is probably why nobody has run into it.
I expected the perf variant to link the same way compat does.
Steps to reproduce
On Linux, from a clean build directory, depend on lbug and build with the perf variant: LBUG_VERSION=0.20.4 LBUG_LINUX_VARIANT=perf cargo build --release.
The link fails with the error above.
Fix
I've opened #39, which links libatomic next to libstdc++ on Linux static builds. Rust passes --as-needed to the linker, so compat binaries don't pick up a new runtime dependency; their NEEDED list is identical before and after. Happy to change it if you'd rather fix it on the engine side.
Activity