From ce267bbe37beb94a6128469f6223be5f07168326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 24 Aug 2018 18:52:10 +0200 Subject: Weak-import global objects used for logging on Apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the dynamic loader will complain about missing symbols when the binary is run on platforms below our supported deployment target: dyld: Symbol not found: __os_activity_current Referenced from: QtCore.framework/Versions/5/QtCore (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib in /Users/torarne/build/qt/5.12/qtbase/lib/QtCore.framework/Versions/5/QtCore Trace/BPT trap: 5 We want this to trigger our own logic in qt_apple_check_os_version(), where we tell the user in more friendly terms what's going on. An alternative to the targeted weak imports would be do import the whole library as weak, using -weak-lSystem.B. This doesn't seem to cause any performance issues at startup, but since we only need the two global symbols we stick to the more targeted solution just to be on the safe side. Change-Id: I87c1f185f6dcf9df26c700d31bb5071ddf7685be Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/kernel/qcore_mac.cpp') diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp index 58380001a4..e78b2d1171 100644 --- a/src/corelib/kernel/qcore_mac.cpp +++ b/src/corelib/kernel/qcore_mac.cpp @@ -65,6 +65,7 @@ QCFString::operator CFStringRef() const #if defined(QT_USE_APPLE_UNIFIED_LOGGING) +QT_MAC_WEAK_IMPORT(_os_log_default); bool AppleUnifiedLogger::messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, const QString &optionalSubsystem) { -- cgit v1.2.3