summaryrefslogtreecommitdiff
path: root/dev-db/mongodb/files/mongodb-8.0.8-fix-compile-error-due-to-deleted-constructor.patch
AgeCommit message (Collapse)Author
2025-09-17dev-db/mongodb: fix build issue w/ clang 20Z. Liu
upstream patch is applied, otherwise the build w/ clang 20 fails with: > src/mongo/bson/util/bsoncolumnbuilder.h:285:49: error: call to deleted constructor of 'const mongo::TrackingAllocator<void> &' However, the build still fails with: > /usr/bin/x86_64-pc-linux-gnu-ld.bfd: build/gentoo/mongo/db/storage/wiredtiger/wiredtiger_record_store.o: in function `mongo::WiredTigerRecordStore::getEarliestOplogTimestamp(mongo::OperationContext*)': > /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/atomic_base.h:1002:(.text+0x7da9): undefined reference to `__atomic_compare_exchange' > clang++: error: linker command failed with exit code 1 (use -v to see invocation) The reason is that Timestamp is a composite type, which requires -latomic when building with clang++ and libstdc++. Mongodb's SConstruct only checks for some basic types ('int64_t', 'uint64_t', 'int32_t', 'uint32_t'), so this case is not detected. Test case below: $ cat a.cc #include <atomic> struct Timestamp { unsigned int t, i; }; template<typename T> struct AtomicWord { std::atomic<T> v; T compareAndSwap(T e, T n) { v.compare_exchange_strong(e,n); return e; } }; int main() { AtomicWord<Timestamp> x; Timestamp a{0,0}, b{1,1}; x.compareAndSwap(a,b); return 0; } $ clang++ -stdlib=libstdc++ a.cc /usr/bin/x86_64-pc-linux-gnu-ld.bfd: /tmp/a-1e3f91.o: in function `std::atomic<Timestamp>::compare_exchange_strong(Timestamp&, Timestamp, std::memory_order, std::memory_order)': a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x222): undefined reference to `__atomic_compare_exchange' /usr/bin/x86_64-pc-linux-gnu-ld.bfd: a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x28d): undefined reference to `__atomic_compare_exchange' /usr/bin/x86_64-pc-linux-gnu-ld.bfd: a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x2f8): undefined reference to `__atomic_compare_exchange' /usr/bin/x86_64-pc-linux-gnu-ld.bfd: a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x3c1): undefined reference to `__atomic_compare_exchange' /usr/bin/x86_64-pc-linux-gnu-ld.bfd: a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x42c): undefined reference to `__atomic_compare_exchange' /usr/bin/x86_64-pc-linux-gnu-ld.bfd: /tmp/a-1e3f91.o:a.cc:(.text._ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_[_ZNSt6atomicI9TimestampE23compare_exchange_strongERS0_S0_St12memory_orderS3_]+0x497): more undefined references to `__atomic_compare_exchange' follow clang++: error: linker command failed with exit code 1 (use -v to see invocation) Signed-off-by: Z. Liu <zhixu.liu@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/43808 Closes: https://github.com/gentoo/gentoo/pull/43808 Signed-off-by: Sam James <sam@gentoo.org>