From 86c4c8e08b5422788bb922290612beaf609de395 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 24 Sep 2023 19:24:06 +0200 Subject: [PATCH] fix build with apple-clang 15 when deployment target of macOS is < 14 see https://bugreports.qt.io/browse/QTBUG-114316 --- recipes/qt/5.x.x/conandata.yml | 20 +++++++++ .../fix-macos-cpp-lib-memory-resource.patch | 43 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 recipes/qt/5.x.x/patches/fix-macos-cpp-lib-memory-resource.patch diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index 9a7989e928d3d..be8ca4b23af75 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -83,6 +83,11 @@ patches: patch_description: "Fix qmake build with apple-clang>=15" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/503916" + - patch_file: "patches/fix-macos-cpp-lib-memory-resource.patch" + base_path: "qt5/qtbase" + patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" "5.15.9": - "base_path": "qt5/qtbase" "patch_file": "patches/aa2a39dea5.diff" @@ -111,6 +116,11 @@ patches: patch_description: "Fix build with apple-clang 15" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/503916" + - patch_file: "patches/fix-macos-cpp-lib-memory-resource.patch" + base_path: "qt5/qtbase" + patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" "5.15.8": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" @@ -139,6 +149,11 @@ patches: patch_description: "Fix build with apple-clang 15" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/503916" + - patch_file: "patches/fix-macos-cpp-lib-memory-resource.patch" + base_path: "qt5/qtbase" + patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" "5.15.7": - patch_file: "patches/337f28c9ab.patch" base_path: "qt5/qtbase" @@ -175,3 +190,8 @@ patches: patch_description: "Fix build with apple-clang 15" patch_type: "portability" patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/503916" + - patch_file: "patches/fix-macos-cpp-lib-memory-resource.patch" + base_path: "qt5/qtbase" + patch_description: "Fix usage of memory_resource with apple-clang>=15 and deployment target of macOS < 14" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392" diff --git a/recipes/qt/5.x.x/patches/fix-macos-cpp-lib-memory-resource.patch b/recipes/qt/5.x.x/patches/fix-macos-cpp-lib-memory-resource.patch new file mode 100644 index 0000000000000..21112d5316d7a --- /dev/null +++ b/recipes/qt/5.x.x/patches/fix-macos-cpp-lib-memory-resource.patch @@ -0,0 +1,43 @@ +--- a/src/corelib/global/qcompilerdetection.h ++++ b/src/corelib/global/qcompilerdetection.h +@@ -1050,16 +1050,22 @@ + # endif // !_HAS_CONSTEXPR + # endif // !__GLIBCXX__ && !_LIBCPP_VERSION + # endif // Q_OS_QNX +-# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ +- && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) ++# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) ++# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) + // Apple has not updated libstdc++ since 2007, which means it does not have + // or std::move. Let's disable these features +-# undef Q_COMPILER_INITIALIZER_LISTS +-# undef Q_COMPILER_RVALUE_REFS +-# undef Q_COMPILER_REF_QUALIFIERS ++# undef Q_COMPILER_INITIALIZER_LISTS ++# undef Q_COMPILER_RVALUE_REFS ++# undef Q_COMPILER_REF_QUALIFIERS + // Also disable , since it's clearly not there +-# undef Q_COMPILER_ATOMICS +-# endif ++# undef Q_COMPILER_ATOMICS ++# endif ++# if defined(__cpp_lib_memory_resource) \ ++ && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) \ ++ || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000)) ++# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17 ++# endif ++# endif // (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) + # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 + // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode + // (probably because libc++'s on OS X failed to compile), but they're missing some +--- a/src/corelib/tools/qduplicatetracker_p.h ++++ b/src/corelib/tools/qduplicatetracker_p.h +@@ -52,7 +52,7 @@ + + #include + +-#if QT_HAS_INCLUDE() && __cplusplus > 201402L ++#if defined(__cpp_lib_memory_resource) && __cplusplus > 201402L + # include + # include + #else