qt5base-lts/mkspecs
Tor Arne Vestbø 27239f4fcf macOS: Explicitly link to debug version of framework when needed
When Qt is configured for both debug and release, and frameworks are
enabled, we produce two dynamic libraries inside each framework, eg:

 QtCore.framework/QtCore
 QtCore.framework/QtCore_debug

When building an executable against these frameworks, we pass -framework
QtCore, and the resulting executable will have its LC_LOAD_DYLIB load
commands pointing to e.g.:

  @rpath/QtCore.framework/Versions/5/QtCore

When running the executable, the dynamic loader will load the dynamic
library dependencies based on these load commands.

By setting the DYLD_IMAGE_SUFFIX environment variable at runtime to
'_debug', the dynamic loader will prefer the debug versions of each
library inside the frameworks.

Unfortunately the use of an environment variable to choose debug or
release versions leaves room for mismatches between the executable
and the libraries that are loaded. An executable built in debug
mode will at runtime pick up the release versions of the Qt libraries
unless the DYLD_IMAGE_SUFFIX has also been set to match the build
configuration of the executable.

This results in confusing situations such as building your application
in debug mode, and then stepping into Qt code but not getting any
symbols. Qt Creator has an option to run the application with
DYLD_IMAGE_SUFFIX set, but this is not enabled by default due
to the startup cost of loading the Qt debug libraries.

More critically, it results in tests failing when the tests are using
QTest::ignoreMessage to ignore warnings produced by Qt, and these
calls are ifdefed (correctly) inside QT_NO_DEBUG, as the test
(built in debug mode) will then expect warnings from Qt, but those
warnings are not emittet, as the test is run against the release
version of the Qt libraries.

To mitigate this mismatch, we now link the Qt frameworks using
an explicit suffix, just like we would for no-framework builds
on macOS, for debug and release builds on Windows, and for
normal builds on other Unixes, leaving the dependency chain
for the application predictable:

 @rpath/QtCore.framework/Versions/5/QtCore_debug

This also conceptually matches how Xcode builds applications and
frameworks, where it never relies on DYLD_IMAGE_SUFFIX, and instead
uses two separate build directories, one for each configuration.

The change means that Qt Creator will always load the Qt debug
libraries if the application is built in debug mode. For Qt
development this is a good thing, as you expect to be able to
step into Qt code. For our users, the added startup cost can
be mitigated by shipping our binary packages as release-only,
but with separate debug info enabled.

Change-Id: Ib9f1f2dab90ed00b9fb011200e3a69c71955e399
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-16 10:30:15 +00:00
..
aix-g++ Updated license headers 2016-01-15 12:25:24 +00:00
aix-g++-64 Updated license headers 2016-01-15 12:25:24 +00:00
android-clang Android: add option -mstackrealign to clang-x86 mkspec 2018-03-06 03:17:24 +00:00
android-g++ Add QIODevice::NewOnly and QIODevice::ExistingOnly OpenMode flags 2018-01-17 04:32:47 +00:00
common mkspecs: Factorize common parts of win32-g++ and win32-clang-g++ 2018-02-21 18:08:01 +00:00
cygwin-g++ Updated license headers 2016-01-15 12:25:24 +00:00
darwin-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
devices Add WFD_DEVICE_CLIENT_TYPE attribute for INTEGRITY S820Am ADP 2018-03-05 11:37:38 +00:00
dummy move all target spec handling to qmake-based configure system 2016-12-13 18:56:34 +00:00
features macOS: Explicitly link to debug version of framework when needed 2018-03-16 10:30:15 +00:00
freebsd-clang make mkspecs not mess up library and include search paths 2017-05-31 12:57:09 +00:00
freebsd-g++ make mkspecs not mess up library and include search paths 2017-05-31 12:57:09 +00:00
haiku-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
hpuxi-g++-64 Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
hurd-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
integrity-armv7 mkspecs: Replace LGPL21 with LGPL license header 2017-03-03 07:26:43 +00:00
integrity-armv7-imx6 mkspecs: Replace LGPL21 with LGPL license header 2017-03-03 07:26:43 +00:00
integrity-armv8-rcar Fix license headers 2018-01-09 07:47:20 +00:00
integrity-x86 mkspecs: Replace LGPL21 with LGPL license header 2017-03-03 07:26:43 +00:00
linux-aarch64-gnu-g++ Add new mkspec for cross-compiling Qt5 for AArch64 2017-03-31 00:34:48 +00:00
linux-arm-gnueabi-g++ Updated license headers 2016-01-15 12:25:24 +00:00
linux-clang Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
linux-clang-libc++ Updated license headers 2016-01-15 12:25:24 +00:00
linux-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
linux-g++-32 Updated license headers 2016-01-15 12:25:24 +00:00
linux-g++-64 Updated license headers 2016-01-15 12:25:24 +00:00
linux-icc Merge remote-tracking branch 'origin/5.9' into dev 2017-08-31 14:31:31 +02:00
linux-icc-32 Updated license headers 2016-01-15 12:25:24 +00:00
linux-icc-64 Updated license headers 2016-01-15 12:25:24 +00:00
linux-icc-k1om linux-icc-k1om build 2017-02-21 14:27:16 +00:00
linux-llvm Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
linux-lsb-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
lynxos-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
macx-clang macOS: Allow tests to mark themselves as not supporting high-DPI 2018-03-14 17:37:34 +00:00
macx-g++ macOS: Bump deployment target to 10.11 2018-02-11 17:02:31 +00:00
macx-icc macOS: Bump deployment target to 10.11 2018-02-11 17:02:31 +00:00
macx-ios-clang Rewrite the Info.plist variable replacement handling 2018-01-06 19:46:00 +00:00
macx-tvos-clang Rewrite the Info.plist variable replacement handling 2018-01-06 19:46:00 +00:00
macx-watchos-clang Rewrite the Info.plist variable replacement handling 2018-01-06 19:46:00 +00:00
macx-xcode Disable Xcode main thread checker by default 2017-11-07 14:53:59 +00:00
modules Adjust wiki links to the new redirect 2015-03-04 15:36:12 +00:00
netbsd-g++ make mkspecs not mess up library and include search paths 2017-05-31 12:57:09 +00:00
openbsd-g++ make mkspecs not mess up library and include search paths 2017-05-31 12:57:09 +00:00
qnx-aarch64le-qcc Enable stack-protector-strong for QNX 7.0.0 2017-06-13 14:01:24 +00:00
qnx-armle-v7-qcc Convert the old feature system 2016-09-15 08:24:10 +00:00
qnx-x86-64-qcc Enable stack-protector-strong for QNX 7.0.0 2017-06-13 14:01:24 +00:00
qnx-x86-qcc Convert the old feature system 2016-09-15 08:24:10 +00:00
solaris-cc Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
solaris-cc-64 Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
solaris-cc-64-stlport Updated license headers 2016-01-15 12:25:24 +00:00
solaris-cc-stlport Updated license headers 2016-01-15 12:25:24 +00:00
solaris-g++ Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
solaris-g++-64 Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
unsupported Stop including net/if.h from qplatformdefs.h 2017-10-08 06:41:24 +00:00
win32-clang-g++ mkspecs: Factorize common parts of win32-g++ and win32-clang-g++ 2018-02-21 18:08:01 +00:00
win32-clang-msvc unify windows mkspecs: define c++ flags explicitly 2018-02-22 18:45:15 +00:00
win32-g++ unify windows mkspecs: define c++ flags explicitly 2018-02-22 18:45:15 +00:00
win32-icc unify windows mkspecs: define c++ flags explicitly 2018-02-22 18:45:15 +00:00
win32-icc-k1om linux-icc-k1om build 2017-02-21 14:27:16 +00:00
win32-msvc unify windows mkspecs: define c++ flags explicitly 2018-02-22 18:45:15 +00:00
winrt-arm-msvc2015 Remove hard-coded MS compiler versions from the mkspecs 2016-12-23 13:45:26 +00:00
winrt-arm-msvc2017 winrt: Add arm mkspec for msvc 2017 2017-04-21 09:49:59 +00:00
winrt-x64-msvc2015 centralize QMAKE_COMPILER_DEFINES+=_WIN32 also for winrt specs 2016-12-30 10:25:11 +00:00
winrt-x64-msvc2017 winrt: Add support for Visual Studio 2017 2017-01-20 13:09:16 +00:00
winrt-x86-msvc2015 centralize QMAKE_COMPILER_DEFINES+=_WIN32 also for winrt specs 2016-12-30 10:25:11 +00:00
winrt-x86-msvc2017 winrt: Add support for Visual Studio 2017 2017-01-20 13:09:16 +00:00