summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/kmsconvenience/qkmsdevice.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-03-09 17:04:37 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-03-16 10:30:15 +0000
commit27239f4fcfa6f64d60e7b79185ff413878152ebd (patch)
tree4ea5bb95076321dc9c011501a3acd275089647c4 /src/platformsupport/kmsconvenience/qkmsdevice.cpp
parentca58c627272b9b49786bfcc44e3b70ca7712a8f2 (diff)
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>
Diffstat (limited to 'src/platformsupport/kmsconvenience/qkmsdevice.cpp')
0 files changed, 0 insertions, 0 deletions