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>
This commit is contained in:
parent
49326b8135
commit
d0783c2c0c
@ -556,6 +556,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"];
|
||||
|
Loading…
x
Reference in New Issue
Block a user