27239f4fcf
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> |
||
---|---|---|
.. | ||
aix-g++ | ||
aix-g++-64 | ||
android-clang | ||
android-g++ | ||
common | ||
cygwin-g++ | ||
darwin-g++ | ||
devices | ||
dummy | ||
features | ||
freebsd-clang | ||
freebsd-g++ | ||
haiku-g++ | ||
hpuxi-g++-64 | ||
hurd-g++ | ||
integrity-armv7 | ||
integrity-armv7-imx6 | ||
integrity-armv8-rcar | ||
integrity-x86 | ||
linux-aarch64-gnu-g++ | ||
linux-arm-gnueabi-g++ | ||
linux-clang | ||
linux-clang-libc++ | ||
linux-g++ | ||
linux-g++-32 | ||
linux-g++-64 | ||
linux-icc | ||
linux-icc-32 | ||
linux-icc-64 | ||
linux-icc-k1om | ||
linux-llvm | ||
linux-lsb-g++ | ||
lynxos-g++ | ||
macx-clang | ||
macx-g++ | ||
macx-icc | ||
macx-ios-clang | ||
macx-tvos-clang | ||
macx-watchos-clang | ||
macx-xcode | ||
modules | ||
netbsd-g++ | ||
openbsd-g++ | ||
qnx-aarch64le-qcc | ||
qnx-armle-v7-qcc | ||
qnx-x86-64-qcc | ||
qnx-x86-qcc | ||
solaris-cc | ||
solaris-cc-64 | ||
solaris-cc-64-stlport | ||
solaris-cc-stlport | ||
solaris-g++ | ||
solaris-g++-64 | ||
unsupported | ||
win32-clang-g++ | ||
win32-clang-msvc | ||
win32-g++ | ||
win32-icc | ||
win32-icc-k1om | ||
win32-msvc | ||
winrt-arm-msvc2015 | ||
winrt-arm-msvc2017 | ||
winrt-x64-msvc2015 | ||
winrt-x64-msvc2017 | ||
winrt-x86-msvc2015 | ||
winrt-x86-msvc2017 |