diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-01-26 16:35:59 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-07 23:14:07 +0000 |
commit | 026fdda1c4e22a5a2b95f2419cd08e8775d08837 (patch) | |
tree | dca4db04d37dc9e50b79bb690d212020fe0b0a0e /src | |
parent | 37fcf98d4280068e15a40fd0ce5bcc55f47c8dd3 (diff) | |
download | qtbase-026fdda1c4e22a5a2b95f2419cd08e8775d08837.tar.gz |
macOS: Skip deployment target runtime check when detecting compat version
When the main executable is built with a pre-macOS 11 SDK, the macOS
kernel and system libraries will enable a compatibility mode for
reporting the system version, reporting 10.16 instead of 11/12/13 etc.
This happens at at such a low level that even manually reading the
version from /System/Library/CoreServices/SystemVersion.plist is
intercepted.
Working around this by temporarily setting the SYSTEM_VERSION_COMPAT
environment variable is unfortunately not possible, as it's only read
on process creation/initialization.
The same goes for the kern.system_version_compat sysctl, as once it's
set it can not be changed back to its original value, and it's not
clear whether this sysctl should even be touched.
As long as we have no reliable way of reading the actual current
operating system version, we need to bail out of the deployment
target verification, to avoid false negatives where a plugin or
library, built with a deployment target of say 11.0, is loaded
into an application built with a pre-11.0 SDK, but running on
macOS 11+.
Change-Id: I9c757a276726175c5dda694ffc1b88f1681d00fb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit bac93ce5eba10ae1e5d165b464a7a9e3b4dd6561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qcore_mac.mm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm index a46bf59a34..a37b6e8875 100644 --- a/src/corelib/kernel/qcore_mac.mm +++ b/src/corelib/kernel/qcore_mac.mm @@ -552,6 +552,14 @@ void qt_apple_check_os_version() const NSOperatingSystemVersion required = (NSOperatingSystemVersion){ version / 10000, version / 100 % 100, version % 100}; const NSOperatingSystemVersion current = NSProcessInfo.processInfo.operatingSystemVersion; + +#if defined(Q_OS_MACOS) + // Check for compatibility version, in which case we can't do a + // comparison to the deployment target, which might be e.g. 11.0 + if (current.majorVersion == 10 && current.minorVersion >= 16) + return; // FIXME: Find a way to detect the real OS version +#endif + if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:required]) { NSDictionary *plist = NSBundle.mainBundle.infoDictionary; NSString *applicationName = plist[@"CFBundleDisplayName"]; |