Skip to content

Commit 5a4eb56

Browse files
committed
Merge bitcoin/bitcoin#28571: depends: fix unusable memory_resource in macos qt build
848eec0 depends: fix unusable memory_resource in macos qt build (fanquake) Pull request description: See https://codereview.qt-project.org/c/qt/qtbase/+/482392. Fixes #28566. ACKs for top commit: hebasto: ACK 848eec0. Tree-SHA512: dd902f7abb09bda3800d78fe58937b4426d974c24ba321b979eba0d6da30fa0c661b4ed629afab827df8f9ab599efc7a288e9f381ec2b3c69d1063d4d4f73f9e
2 parents d0b928b + 848eec0 commit 5a4eb56

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

depends/packages/qt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $(package)_patches += duplicate_lcqpafonts.patch
2323
$(package)_patches += fast_fixed_dtoa_no_optimize.patch
2424
$(package)_patches += guix_cross_lib_path.patch
2525
$(package)_patches += fix-macos-linker.patch
26+
$(package)_patches += memory_resource.patch
2627

2728
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
2829
$(package)_qttranslations_sha256_hash=c92af4171397a0ed272330b4fa0669790fcac8d050b07c8b8cc565ebeba6735e
@@ -248,6 +249,7 @@ define $(package)_preprocess_cmds
248249
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
249250
patch -p1 -i $($(package)_patch_dir)/fix_montery_include.patch && \
250251
patch -p1 -i $($(package)_patch_dir)/use_android_ndk23.patch && \
252+
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
251253
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
252254
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
253255
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Fix unusable memory_resource on macos
2+
3+
See https://bugreports.qt.io/browse/QTBUG-117484
4+
and https://bugreports.qt.io/browse/QTBUG-114316
5+
6+
--- a/qtbase/src/corelib/tools/qduplicatetracker_p.h
7+
+++ b/qtbase/src/corelib/tools/qduplicatetracker_p.h
8+
@@ -52,7 +52,7 @@
9+
10+
#include <qglobal.h>
11+
12+
-#if QT_HAS_INCLUDE(<memory_resource>) && __cplusplus > 201402L
13+
+#ifdef __cpp_lib_memory_resource
14+
# include <unordered_set>
15+
# include <memory_resource>
16+
#else
17+
18+
--- a/qtbase/src/corelib/global/qcompilerdetection.h
19+
+++ b/qtbase/src/corelib/global/qcompilerdetection.h
20+
@@ -1041,16 +1041,22 @@
21+
# endif // !_HAS_CONSTEXPR
22+
# endif // !__GLIBCXX__ && !_LIBCPP_VERSION
23+
# endif // Q_OS_QNX
24+
-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \
25+
- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
26+
+# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC)
27+
+# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
28+
// Apple has not updated libstdc++ since 2007, which means it does not have
29+
// <initializer_list> or std::move. Let's disable these features
30+
-# undef Q_COMPILER_INITIALIZER_LISTS
31+
-# undef Q_COMPILER_RVALUE_REFS
32+
-# undef Q_COMPILER_REF_QUALIFIERS
33+
+# undef Q_COMPILER_INITIALIZER_LISTS
34+
+# undef Q_COMPILER_RVALUE_REFS
35+
+# undef Q_COMPILER_REF_QUALIFIERS
36+
// Also disable <atomic>, since it's clearly not there
37+
-# undef Q_COMPILER_ATOMICS
38+
-# endif
39+
+# undef Q_COMPILER_ATOMICS
40+
+# endif
41+
+# if defined(__cpp_lib_memory_resource) \
42+
+ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \
43+
+ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000))
44+
+# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17
45+
+# endif
46+
+# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC)
47+
# if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500
48+
// ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode
49+
// (probably because libc++'s <atomic> on OS X failed to compile), but they're missing some

0 commit comments

Comments
 (0)