Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt5: fix build with apple-clang 15 + add package_type + bump deps + use version range for zlib #20093

Merged
merged 12 commits into from
Oct 26, 2023
50 changes: 50 additions & 0 deletions recipes/qt/5.x.x/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,37 @@
- "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz"
sha256: "8a71986676a3f37a198a9113acedbfd5bc5606a459b6b85816d951458adbe9a0"
patches:
"5.15.11":
- "base_path": "qt5/qtbase"
"patch_file": "patches/aa2a39dea5.diff"

Check warning on line 82 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 81)
- "base_path": "qt5/qtwebengine"
"patch_file": "patches/c72097e.diff"

Check warning on line 84 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine ^ (line: 83)
- "base_path": "qt5/qttools"
"patch_file": "patches/fix-macdeployqt.diff"

Check warning on line 86 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qttools ^ (line: 85)
- "base_path": "qt5/qtwebengine/src/3rdparty/chromium/v8"
"patch_file": "patches/chromium-v8-missing-constexpr.patch"

Check warning on line 88 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 87)
- "base_path": "qt5/qtwebengine/src/3rdparty"
"patch_file": "patches/chromium-skia-missing-iterator-include.patch"

Check warning on line 90 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 89)
- "base_path": "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia"
"patch_file": "patches/skia-cd397f3.diff"

Check warning on line 92 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 91)
- "base_path": "qt5/qtwebengine/src/3rdparty"
"patch_file": "patches/0001-Find-fontconfig-using-pkg-config.patch"

Check warning on line 94 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 93)
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-backtrace.diff"

Check warning on line 96 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 95)
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-openssl.diff"

Check warning on line 98 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 97)
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-new-ndk.diff"

Check warning on line 100 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 99)
- patch_file: "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch"
base_path: "qt5/qtbase"
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/5.15.10-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.10":
- "base_path": "qt5/qtbase"
"patch_file": "patches/aa2a39dea5.diff"
Expand All @@ -121,6 +131,16 @@
"patch_file": "patches/android-openssl.diff"
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-new-ndk.diff"
- patch_file: "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch"
base_path: "qt5/qtbase"
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/5.15.10-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"
Expand All @@ -144,6 +164,16 @@
"patch_file": "patches/android-openssl.diff"
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-new-ndk.diff"
- patch_file: "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch"
base_path: "qt5/qtbase"
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/5.15.7-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"
Expand All @@ -167,6 +197,16 @@
base_path: "qt5/qtbase"
- patch_file: "patches/android-new-ndk.diff"
base_path: "qt5/qtbase"
- patch_file: "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch"
base_path: "qt5/qtbase"
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/5.15.7-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"
Expand Down Expand Up @@ -198,3 +238,13 @@
base_path: "qt5/qtbase"
- patch_file: "patches/android-new-ndk.diff"
base_path: "qt5/qtbase"
- patch_file: "patches/5.15.7-fix-qmake-default-libdirs-apple-clang-15.patch"
base_path: "qt5/qtbase"
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/5.15.7-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"
67 changes: 34 additions & 33 deletions recipes/qt/5.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import msvc_runtime_flag, is_msvc, VCVars
from conan.tools.microsoft import is_msvc, msvc_runtime_flag, is_msvc_static_runtime, VCVars
from conan.tools.scm import Version
import configparser
import glob
Expand All @@ -15,7 +15,7 @@
import textwrap
import shutil

required_conan_version = ">=1.59.0"
required_conan_version = ">=1.60.0 <2 || >=2.0.5"


class QtConan(ConanFile):
Expand All @@ -33,7 +33,7 @@
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.qt.io"
license = "LGPL-3.0-only"

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand Down Expand Up @@ -308,7 +308,7 @@
raise ConanInvalidConfiguration("Qt without libc++ needs qt:with_doubleconversion. "
"Either enable qt:with_doubleconversion or switch to libc++")

if "MT" in self.settings.get_safe("compiler.runtime", default="") and self.options.shared:
if is_msvc_static_runtime(self) and self.options.shared:
raise ConanInvalidConfiguration("Qt cannot be built as shared library with static runtime")

if self.settings.compiler == "apple-clang":
Expand Down Expand Up @@ -349,7 +349,7 @@
if is_apple_os(self):
self.requires("moltenvk/1.2.2")
if self.options.with_glib:
self.requires("glib/2.77.0")
self.requires("glib/2.78.0")
# if self.options.with_libiconv: # QTBUG-84708
# self.requires("libiconv/1.16")# QTBUG-84708
if self.options.with_doubleconversion and not self.options.multiconfiguration:
Expand All @@ -361,56 +361,56 @@
if self.options.get_safe("with_icu", False):
self.requires("icu/73.2")
if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration:
self.requires("harfbuzz/8.0.1")
self.requires("harfbuzz/8.2.1")
if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration:
if self.options.with_libjpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/2.1.5")
self.requires("libjpeg-turbo/3.0.0")
else:
self.requires("libjpeg/9e")
if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration:
self.requires("libpng/1.6.40")
if self.options.with_sqlite3 and not self.options.multiconfiguration:
self.requires("sqlite3/3.42.0")
self.requires("sqlite3/3.43.1")
if self.options.get_safe("with_mysql", False):
self.requires("libmysqlclient/8.0.31")
self.requires("libmysqlclient/8.1.0")
if self.options.with_pq:
self.requires("libpq/15.3")
self.requires("libpq/15.4")
if self.options.with_odbc:
if self.settings.os != "Windows":
self.requires("odbc/2.3.11")
if self.options.get_safe("with_openal", False):
self.requires("openal-soft/1.22.2")
if self.options.get_safe("with_libalsa", False):
self.requires("libalsa/1.2.7.2")
if self.options.get_safe("with_x11", False):
self.requires("xkbcommon/1.5.0")
self.requires("libalsa/1.2.10")
if self.options.get_safe("with_x11"):
self.requires("xorg/system")
if self.options.get_safe("with_x11") or self.options.qtwayland:
self.requires("xkbcommon/1.5.0")
if self.options.get_safe("opengl", "no") != "no":
self.requires("opengl/system")
if self.options.with_zstd:
self.requires("zstd/1.5.5")
if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]:
self.requires("expat/2.5.0")
self.requires("opus/1.3.1")
self.requires("opus/1.4")
if not self.options.qtwayland:
self.requires("xorg-proto/2022.2")
self.requires("libxshmfence/1.3")
self.requires("nss/3.89")
self.requires("nss/3.93")
self.requires("libdrm/2.4.114")
self.requires("egl/system")
if self.options.get_safe("with_gstreamer", False):
self.requires("gst-plugins-base/1.19.2")
if self.options.get_safe("with_pulseaudio", False):
self.requires("pulseaudio/14.2")
if self.options.with_dbus:
self.requires("dbus/1.15.6")
self.requires("dbus/1.15.8")
if self.options.qtwayland:
self.requires("wayland/1.22.0")
self.requires("xkbcommon/1.5.0")
if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi:
self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102
if self.options.get_safe("with_atspi"):
self.requires("at-spi2-core/2.49.1")
self.requires("at-spi2-core/2.50.0")
if self.options.get_safe("with_md4c", False):
self.requires("md4c/0.4.8")

Expand All @@ -437,12 +437,12 @@
self.tool_requires("gperf/3.1")
# gperf, bison, flex, python >= 2.7.5 & < 3
if self._settings_build.os == "Windows":
self.tool_requires("winflexbison/2.5.24")
self.tool_requires("winflexbison/2.5.25")
else:
self.tool_requires("bison/3.8.2")
self.tool_requires("flex/2.6.4")
if self.options.qtwayland:
self.tool_requires("wayland/1.22.0")
self.tool_requires("wayland/<host_version>")

def source(self):
get(self, **self.conan_data["sources"][self.version],
Expand Down Expand Up @@ -475,18 +475,6 @@
env.prepend_path("PKG_CONFIG_PATH", self.generators_folder)
if self.settings.os == "Windows":
env.prepend_path("PATH", os.path.join(self.source_folder, "qt5", "gnuwin32", "bin"))
if self._settings_build.os == "Macos":
# On macOS, SIP resets DYLD_LIBRARY_PATH injected by VirtualBuildEnv & VirtualRunEnv
dyld_library_path = "$DYLD_LIBRARY_PATH"
dyld_library_path_build = vbe.vars().get("DYLD_LIBRARY_PATH")
if dyld_library_path_build:
dyld_library_path = f"{dyld_library_path_build}:{dyld_library_path}"
if not cross_building(self):
dyld_library_path_host = vre.vars().get("DYLD_LIBRARY_PATH")
if dyld_library_path_host:
dyld_library_path = f"{dyld_library_path_host}:{dyld_library_path}"
save(self, "bash_env", f'export DYLD_LIBRARY_PATH="{dyld_library_path}"')
env.define_path("BASH_ENV", os.path.abspath("bash_env"))
env.vars(self).save_script("conan_qt_env_file")

def _make_program(self):
Expand Down Expand Up @@ -801,6 +789,19 @@
if self._settings_build.os == "Linux" and self.settings.compiler == "clang":
args += ['QMAKE_CXXFLAGS+="-ftemplate-depth=1024"']

if self._settings_build.os == "Macos":
# On macOS, SIP resets DYLD_LIBRARY_PATH injected by VirtualBuildEnv & VirtualRunEnv.
# Qt builds several executables (moc etc) which are called later on during build of
# libraries, and these executables link to several external dependencies in requirements().
# If these external libs are shared, moc calls fail because its dylib dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the inspiration for this come from? Any extra insight would be appreciated :) but looks good to me

Copy link
Contributor Author

@SpaceIm SpaceIm Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this error locally without this workaround: #20093 (comment). Injection of VirtualRunEnv in build scope doesn't work on macOS due to SIP (at some point SIP resets DYLD_LIBRARY_PATH, I don't kno exactly when it happens during build, but it's a fact). Previous BASH_ENV workaround doesn't work either depending on terminal (zsh doesn't care for example). So if correct zlib version (matching the one installed by conan) is not installed on system, it fails.
The only workaround I've found is to add path to shared libs in LC_RPATH of runtimes built during qt build, SIP can't do anything against that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might this cause rsulting binaries inside the package to have an absolute rpath to folders only present in the build machine? @SpaceIm

# are not found (unless they can be accidentally found in system paths).
# So the workaround is to add libdirs of these external dependencies to LC_RPATH
# of runtime artifacts.
if not cross_building(self):
for libpath in VirtualRunEnv(self).vars().get("DYLD_LIBRARY_PATH", "").split(":"):
# see https://doc.qt.io/qt-5/qmake-variable-reference.html#qmake-rpathdir
args += [f"QMAKE_RPATHDIR+=\"{libpath}\""]

if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]:
args += ["-qt-webengine-ffmpeg",
"-system-webengine-opus",
Expand Down Expand Up @@ -920,7 +921,7 @@
filecontents += 'set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")\n'
save(self, os.path.join(self.package_folder, self._cmake_core_extras_file), filecontents)

def _create_private_module(module, dependencies=[]):

Check warning on line 924 in recipes/qt/5.x.x/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Dangerous default value [] as argument
if "Core" not in dependencies:
dependencies.append("Core")
dependencies_string = ';'.join(f'Qt5::{dependency}' for dependency in dependencies)
Expand Down Expand Up @@ -989,7 +990,7 @@
reqs.append(corrected_req)
return reqs

def _create_module(module, requires=[], has_include_dir=True):

Check warning on line 993 in recipes/qt/5.x.x/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Dangerous default value [] as argument
componentname = f"qt{module}"
assert componentname not in self.cpp_info.components, f"Module {module} already present in self.cpp_info.components"
self.cpp_info.components[componentname].set_property("cmake_target_name", f"Qt5::{module}")
Expand Down Expand Up @@ -1047,7 +1048,7 @@
"exec_prefix=${prefix}",
]
self.cpp_info.components["qtCore"].set_property("pkg_config_custom_content", "\n".join(pkg_config_vars))

if self.settings.os == "Windows":
module = "WinMain"
componentname = f"qt{module}"
Expand Down
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
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
@@ -1041,16 +1041,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -283,9 +283,12 @@ isEmpty($${target_prefix}.INCDIRS) {
}
}
}
- isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \
+ isEmpty(QMAKE_DEFAULT_INCDIRS): \
!integrity: \
- error("failed to parse default search paths from compiler output")
+ error("failed to parse default include paths from compiler output")
+ isEmpty(QMAKE_DEFAULT_LIBDIRS): \
+ !integrity:!darwin: \
+ error("failed to parse default library paths from compiler output")
QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
} else: ghs {
cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp
@@ -407,7 +410,7 @@ isEmpty($${target_prefix}.INCDIRS) {
QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP)
}

- unix:if(!cross_compile|host_build) {
+ unix:!darwin:if(!cross_compile|host_build) {
isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include
isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib
}
Loading