commit:     7aef3a2cb7ab75763a50c48f1b7a97052fbe47c8
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Wed Jan 21 14:50:05 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 25 06:45:49 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7aef3a2c

dev-db/mysql: fix build with clang 20+

by using patch from upstream

Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45485
Closes: https://github.com/gentoo/gentoo/pull/45485
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../mysql-8.0.43-fix-clang-20-allocator.patch      | 56 ++++++++++++++++++++++
 dev-db/mysql/mysql-8.0.43.ebuild                   |  2 +
 2 files changed, 58 insertions(+)

diff --git a/dev-db/mysql/files/mysql-8.0.43-fix-clang-20-allocator.patch 
b/dev-db/mysql/files/mysql-8.0.43-fix-clang-20-allocator.patch
new file mode 100644
index 000000000000..47a8dfabeca0
--- /dev/null
+++ b/dev-db/mysql/files/mysql-8.0.43-fix-clang-20-allocator.patch
@@ -0,0 +1,56 @@
+https://github.com/mysql/mysql-server/commit/f5b7993d23fe93dd417160d7bbc19c20050b2ffe
+
+From f5b7993d23fe93dd417160d7bbc19c20050b2ffe Mon Sep 17 00:00:00 2001
+From: Tor Didriksen <[email protected]>
+Date: Wed, 2 Jul 2025 12:15:06 +0200
+Subject: [PATCH] Bug#38142283 Compile MySQL with clang 20 [allocator noclose]
+
+Clang on Linux normally uses STL headers/libraries from gcc.  There is
+evidently some mismatch of template instantiations, and build break
+for the default CTOR ut::allocator::allocator().
+
+include/c++/15/bits/hashtable_policy.h:1475:76: error:
+chosen constructor is explicit in copy-initialization
+
+ut0new.h:2200:12: note: explicit constructor declared here
+ 2200 |   explicit allocator(PSI_memory_key key = mem_key_std) : 
Allocator_base(key) {}
+
+The actual problem is strict checking for explicit constructors during
+copy initializations. We have two choices to fix it:
+
+1- Make the allocator declarations explicit.
+2- Create another non-explicit default constructor.
+
+This patch implements alternative 2.
+
+Note: There is no build break for clang when using -stdlib=libc++
+but this is non-standard on Linux.
+
+Change-Id: I02d81329ad5a61309b09d8fc1230b2b7ade8c20c
+(cherry picked from commit f97007197c9f366136c2d27b093ee73fda0581e0)
+(cherry picked from commit 0e66e10f29aa6f328b790132b82e90f55bc764c4)
+
+diff --git a/storage/innobase/include/ut0new.h 
b/storage/innobase/include/ut0new.h
+index 859c556f73a..295067ede24 100644
+--- a/storage/innobase/include/ut0new.h
++++ b/storage/innobase/include/ut0new.h
+@@ -2193,10 +2193,14 @@ class allocator : public Allocator_base {
+                 "ut::allocator does not support over-aligned types. Use "
+                 "ut::aligned_* API to handle such types.");
+ 
+-  /** Default constructor.
++  /** Default constructor, use mem_key_std.
++   */
++  allocator() : Allocator_base(mem_key_std) {}
++
++  /** Explicit constructor.
+       @param[in] key  performance schema key.
+     */
+-  explicit allocator(PSI_memory_key key = mem_key_std) : Allocator_base(key) 
{}
++  explicit allocator(PSI_memory_key key) : Allocator_base(key) {}
+ 
+   /* Rule-of-five */
+   allocator(const allocator<T, Allocator_base> &) = default;
+-- 
+2.49.1
+

diff --git a/dev-db/mysql/mysql-8.0.43.ebuild b/dev-db/mysql/mysql-8.0.43.ebuild
index 2dd10d10bd0a..03741fe89cdb 100644
--- a/dev-db/mysql/mysql-8.0.43.ebuild
+++ b/dev-db/mysql/mysql-8.0.43.ebuild
@@ -119,6 +119,8 @@ PATCHES=(
        "${FILESDIR}"/mysql-8.0.37-fix-bundled-boost.patch
        # Needed due to bundled abseil-cpp-20230802, this fix is included in 
abseil-cpp-20240722
        "${FILESDIR}"/mysql-8.0.37-fix-bundled-abseil.patch
+       # for 8.0.43 only
+       "${FILESDIR}"/mysql-8.0.43-fix-clang-20-allocator.patch
 )
 
 mysql_init_vars() {

Reply via email to