summaryrefslogtreecommitdiff
path: root/dev-db/mongodb
diff options
context:
space:
mode:
authorZ. Liu <zhixu.liu@gmail.com>2025-09-16 04:09:35 +0000
committerSam James <sam@gentoo.org>2025-09-17 22:27:44 +0100
commit575b35af90ef010ee1531f55165de9b5b34d4c7c (patch)
tree3d91e17e4bdc806f98f6b5d032d502778a361163 /dev-db/mongodb
parent222d189042a6be146c7650ed8d18b2c8fcc26632 (diff)
downloadgentoo-575b35af90ef010ee1531f55165de9b5b34d4c7c.tar.gz
gentoo-575b35af90ef010ee1531f55165de9b5b34d4c7c.tar.bz2
gentoo-575b35af90ef010ee1531f55165de9b5b34d4c7c.zip
dev-db/mongodb: fix build issue w/ clang 20
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>
Diffstat (limited to 'dev-db/mongodb')
-rw-r--r--dev-db/mongodb/files/mongodb-8.0.8-fix-compile-error-due-to-deleted-constructor.patch28
-rw-r--r--dev-db/mongodb/files/mongodb-8.0.8-sconstruct.patch45
-rw-r--r--dev-db/mongodb/mongodb-8.0.12.ebuild2
-rw-r--r--dev-db/mongodb/mongodb-8.0.8.ebuild2
4 files changed, 77 insertions, 0 deletions
diff --git a/dev-db/mongodb/files/mongodb-8.0.8-fix-compile-error-due-to-deleted-constructor.patch b/dev-db/mongodb/files/mongodb-8.0.8-fix-compile-error-due-to-deleted-constructor.patch
new file mode 100644
index 000000000000..017aeee15ee1
--- /dev/null
+++ b/dev-db/mongodb/files/mongodb-8.0.8-fix-compile-error-due-to-deleted-constructor.patch
@@ -0,0 +1,28 @@
+https://jira.mongodb.org/browse/SERVER-97048
+
+From ce43ef7147fabfa5b7f14a3040a0fc19b9228d9f Mon Sep 17 00:00:00 2001
+From: James Bronsted <32047428+jpbronsted@users.noreply.github.com>
+Date: Wed, 27 Nov 2024 17:59:39 -0500
+Subject: [PATCH] SERVER-97048 fix compile error on Clang 19 due to
+ BSONColumnBuilder default constructor (#29231)
+
+GitOrigin-RevId: 82d5ad449944292fe4cfdb7a27886439725d58de
+
+diff --git a/src/mongo/bson/util/bsoncolumnbuilder.h b/src/mongo/bson/util/bsoncolumnbuilder.h
+index d9cd20e07b7..b7d36fa1b28 100644
+--- a/src/mongo/bson/util/bsoncolumnbuilder.h
++++ b/src/mongo/bson/util/bsoncolumnbuilder.h
+@@ -282,7 +282,9 @@ struct EncodingState {
+ template <class Allocator = std::allocator<void>>
+ class BSONColumnBuilder {
+ public:
+- explicit BSONColumnBuilder(const Allocator& = {});
++ template <typename A = Allocator>
++ BSONColumnBuilder() : BSONColumnBuilder{A{}} {}
++ explicit BSONColumnBuilder(const Allocator&);
+ explicit BSONColumnBuilder(allocator_aware::BufBuilder<Allocator>, const Allocator& = {});
+
+ /**
+--
+2.49.1
+
diff --git a/dev-db/mongodb/files/mongodb-8.0.8-sconstruct.patch b/dev-db/mongodb/files/mongodb-8.0.8-sconstruct.patch
new file mode 100644
index 000000000000..e0f6c71a80a9
--- /dev/null
+++ b/dev-db/mongodb/files/mongodb-8.0.8-sconstruct.patch
@@ -0,0 +1,45 @@
+check whether "-latomic" is required for composite type, see src/mongo/bson/timestamp.h,
+otherwise the build 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)
+
+diff --git a/SConstruct b/SConstruct
+index 2a32456..4cfb5fd 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -5369,10 +5369,33 @@ def doConfigure(myenv):
+
+ conf.AddTest("CheckStdAtomic", CheckStdAtomic)
+
++ def CheckTimestampAtomic(context, extra_message):
++ test_body = """
++ #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;
++ }
++ """
++
++ context.Message("Checking if AtomicWord<Timestamp> works{0}... ".format(extra_message))
++
++ ret = context.TryLink(textwrap.dedent(test_body), ".cpp")
++ context.Result(ret)
++ return ret
++
++ conf.AddTest("CheckTimestampAtomic", CheckTimestampAtomic)
++
+ def check_all_atomics(extra_message=''):
+ for t in ('int64_t', 'uint64_t', 'int32_t', 'uint32_t'):
+ if not conf.CheckStdAtomic(t, extra_message):
+ return False
++ if not conf.CheckTimestampAtomic(extra_message):
++ return False
+ return True
+
+ if not check_all_atomics():
diff --git a/dev-db/mongodb/mongodb-8.0.12.ebuild b/dev-db/mongodb/mongodb-8.0.12.ebuild
index e33182d058bb..d118329a1c89 100644
--- a/dev-db/mongodb/mongodb-8.0.12.ebuild
+++ b/dev-db/mongodb/mongodb-8.0.12.ebuild
@@ -75,6 +75,8 @@ PATCHES=(
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.6-fixes-for-boost-1.85.patch"
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.4-scons.patch"
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.6-use-tenacity.patch"
+ "${FILESDIR}/${PN}-8.0.8-sconstruct.patch"
+ "${FILESDIR}/${PN}-8.0.8-fix-compile-error-due-to-deleted-constructor.patch"
"${FILESDIR}/boost_issue_402.patch"
"${FILESDIR}/${PN}-8.0.12-sconstruct.patch"
)
diff --git a/dev-db/mongodb/mongodb-8.0.8.ebuild b/dev-db/mongodb/mongodb-8.0.8.ebuild
index 8706d359fe62..c7d6d01725be 100644
--- a/dev-db/mongodb/mongodb-8.0.8.ebuild
+++ b/dev-db/mongodb/mongodb-8.0.8.ebuild
@@ -77,6 +77,8 @@ PATCHES=(
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.4-scons.patch"
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.6-mozjs-remove-unused-constructor.patch"
"${WORKDIR}/mongodb-8.0.8-patches/${PN}-8.0.6-use-tenacity.patch"
+ "${FILESDIR}/${PN}-8.0.8-sconstruct.patch"
+ "${FILESDIR}/${PN}-8.0.8-fix-compile-error-due-to-deleted-constructor.patch"
)
python_check_deps() {