Skip to content

Commit

Permalink
fix build with apple-clang 15 when deployment target of macOS is < 14
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Sep 24, 2023
1 parent 42130b2 commit 86c4c8e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
20 changes: 20 additions & 0 deletions recipes/qt/5.x.x/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Check notice on line 87 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
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"
Expand Down Expand Up @@ -111,6 +116,11 @@ patches:
patch_description: "Fix build with apple-clang 15"

Check notice on line 116 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
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"

Check notice on line 121 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
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"
Expand Down Expand Up @@ -139,6 +149,11 @@ patches:
patch_description: "Fix build with apple-clang 15"
patch_type: "portability"

Check notice on line 150 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
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"

Check notice on line 155 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/482392"
"5.15.7":
- patch_file: "patches/337f28c9ab.patch"
base_path: "qt5/qtbase"
Expand Down Expand Up @@ -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"

Check notice on line 192 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
- 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"

Check notice on line 197 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
43 changes: 43 additions & 0 deletions recipes/qt/5.x.x/patches/fix-macos-cpp-lib-memory-resource.patch
Original file line number Diff line number Diff line change
@@ -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
// <initializer_list> 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 <atomic>, 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 <atomic> 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 <qglobal.h>

-#if QT_HAS_INCLUDE(<memory_resource>) && __cplusplus > 201402L
+#if defined(__cpp_lib_memory_resource) && __cplusplus > 201402L
# include <unordered_set>
# include <memory_resource>
#else

0 comments on commit 86c4c8e

Please sign in to comment.