qt5base-lts/mkspecs/features
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
..
android Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flags 2018-01-20 18:16:59 +00:00
data Merge remote-tracking branch 'origin/5.10' into dev 2018-01-02 09:58:44 +01:00
mac Apple: resolve SDK version of QMAKE_LINK_C and QMAKE_LINK_C_SHLIB 2018-03-07 18:12:11 +00:00
uikit Merge remote-tracking branch 'origin/5.9' into 5.10 2017-12-30 12:09:53 +01:00
unix Merge remote-tracking branch 'origin/5.9' into 5.10 2017-09-06 13:26:31 +02:00
win32 Fix VS project generation for ActiveQt server projects 2017-05-23 06:56:47 +00:00
winrt winrt: remove legacy checks 2017-07-03 05:32:54 +00:00
benchmark.prf mkspecs: Add a benchmark "feature". 2016-03-02 21:24:54 +00:00
build_pass.prf Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
cmake_functions.prf Remove leading '/' from target paths. 2013-11-27 08:24:50 +01:00
configure_base.prf don't redirect licheck's stderr 2017-05-31 12:57:43 +00:00
configure.prf make handling of built-in configure options data-driven 2016-12-13 18:55:28 +00:00
create_cmake.prf stop exporting QT.*.{MAJOR,MINOR,PATCH}_VERSION in module pris 2017-02-06 16:33:18 +00:00
ctest_testcase_common.prf Merge remote-tracking branch 'origin/5.9' into 5.10 2017-10-16 22:21:52 +03:00
ctest_testcase_installed.prf Only run the cmake test in the install location if not already done. 2013-07-15 21:56:51 +02:00
ctest_testcase.prf Always use forward slashes in paths passed to cmake. 2013-07-10 13:05:01 +02:00
dbusadaptors.prf de-duplicate dbusadaptors.prf vs. dbusinterfaces.prf 2012-08-04 00:52:38 +02:00
dbuscommon.pri don't override user-provided dependencies for our extra compilers 2016-06-23 13:25:22 +00:00
dbusinterfaces.prf de-duplicate dbusadaptors.prf vs. dbusinterfaces.prf 2012-08-04 00:52:38 +02:00
declarative_debug.prf Rename quick1_debug back to declarative_debug 2012-10-04 03:03:00 +02:00
default_post.prf Generate gdb indexing for faster debugging on Linux 2017-12-19 11:50:12 +00:00
default_pre.prf configure: during early setup, skip all of default_pre.prf 2017-12-14 18:06:07 +00:00
designer_defines.prf dispose of library-bound feature files 2012-06-19 16:39:52 +02:00
device_config.prf nuke configure -host-option 2016-12-13 18:55:59 +00:00
egl.prf Adjust egl config.test to pass sysrooted libs 2016-04-08 23:37:07 +00:00
exceptions_off.prf turn off exceptions by default where they aren't required 2012-05-17 05:14:26 +02:00
exceptions.prf turn off exceptions by default where they aren't required 2012-05-17 05:14:26 +02:00
exclusive_builds_post.prf Rewrite qmake's exclusive-build feature 2013-10-25 20:50:51 +02:00
exclusive_builds.prf Support for LTTNG and ETW tracing 2018-01-28 19:17:02 +00:00
file_copies.prf Simplify built-in qmake install command 2017-05-04 09:40:48 +00:00
gcov.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
include_source_dir.prf Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
incredibuild_xge.prf untangle use of system vs. shell path(-list) semantics 2014-04-30 16:56:54 +02:00
java.prf Android: remove support for local/debug deployment 2017-09-06 18:21:02 +00:00
lex.prf Fix building when lex source refers to a file generated by yacc 2016-11-01 04:41:21 +00:00
link_ltcg.prf Support different job counts also for ICC LTO 2017-04-07 17:45:04 +00:00
link_pkgconfig.prf make the pkg-config error message more precise 2014-01-07 19:45:15 +01:00
ltcg.prf Clean up ltcg.prf with variables, including a new static mode 2015-01-11 03:41:48 +01:00
moc.prf Merge remote-tracking branch 'origin/5.9' into 5.10 2017-09-20 11:58:32 +02:00
no_debug_info.prf qmake: Remove Windows CE support. 2016-03-10 13:33:44 +00:00
plugin_bundle.prf Ensure that CONFIG += plugin_bundle will create Mach-O bundles on OSX/iOS 2015-05-24 11:46:14 +00:00
precompile_header.prf Fix build with precompile headers 2014-01-14 10:38:29 +01:00
qgltf.prf don't override user-provided dependencies for our extra compilers 2016-06-23 13:25:22 +00:00
qlalr.prf fix qlalr invocation in silent builds 2016-12-07 06:54:33 +00:00
qmake_use.prf fix usage of "empty" libraries 2017-02-22 07:45:52 +00:00
qml1_module.prf mark a bunch of features as internal 2012-12-12 21:48:02 +01:00
qml1_plugin.prf mark a bunch of features as internal 2012-12-12 21:48:02 +01:00
qml_debug.prf Rename the 'declarative debug support' to 'qml debug support' 2012-03-31 16:33:04 +02:00
qml_module.prf Fix missing plugins.qmltypes in static builds 2016-08-17 15:45:51 +00:00
qml_plugin.prf stop exporting QT.*.{MAJOR,MINOR,PATCH}_VERSION in module pris 2017-02-06 16:33:18 +00:00
qmltestcase.prf qmltestcase: Allow a QML-only testcase to not require a C++ harness 2017-04-06 08:40:17 +00:00
qt_android_deps.prf make use of silent error() emission 2016-08-08 09:48:41 +00:00
qt_app.prf Windows: Automatically set metadata for all Qt apps 2017-07-31 06:19:06 +00:00
qt_build_config.prf Support for LTTNG and ETW tracing 2018-01-28 19:17:02 +00:00
qt_build_extra.prf Merge remote-tracking branch 'origin/5.7' into 5.8 2016-08-29 15:30:17 +02:00
qt_build_paths.prf make force_independent live up to its name 2015-11-30 14:26:23 +00:00
qt_clear_installs.prf disable install targets for non-prefix builds 2016-01-12 15:16:37 +00:00
qt_common.prf Turn on more warnings for Objective-C code on Apple platforms 2018-03-05 19:31:31 +00:00
qt_config.prf stop exporting QT.*.{libexecs,plugins,imports,qml} in module pris 2017-02-06 16:33:25 +00:00
qt_configure.prf configure: introduce 'subarch' term to expression evaluator 2018-02-22 21:39:36 +00:00
qt_docs_targets.prf generalize references to exclusive builds 2016-07-13 14:27:07 +00:00
qt_docs.prf Pass the include paths to qdoc 2017-12-08 17:50:11 +00:00
qt_example_installs.prf fix installation of resources for example sources 2018-02-21 16:32:49 +00:00
qt_functions.prf Qmake: Introduce and use QMAKE_{SYSTEM,SHELL}_NULL_DEVICE variable, take 2 2017-10-13 13:32:36 +00:00
qt_helper_lib.prf fix usage of "empty" libraries 2017-02-22 07:45:52 +00:00
qt_installs.prf Fix shadow prefix framework builds 2017-11-02 15:23:18 +00:00
qt_module_headers.prf syncqt: fix injected headers outside qtbase in non-prefix builds 2018-02-15 17:02:34 +00:00
qt_module_pris.prf Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-27 10:42:08 +02:00
qt_module.prf Add -DQT_{module}_LIB in pkg-config cflags for each Qt module 2018-01-24 16:08:22 +00:00
qt_parts.prf Introduce QMAKE_CD to enable us to cd from one Windows drive to another 2016-11-14 16:03:39 +00:00
qt_plugin.prf Merge remote-tracking branch 'origin/5.10' into dev 2018-01-02 09:58:44 +01:00
qt_targets.prf Make Qt's VersionInformation resource strings consistent 2017-07-03 06:02:03 +00:00
qt_tool.prf Windows: Automatically set metadata for all Qt apps 2017-07-31 06:19:06 +00:00
qt_tracepoints.prf Support for LTTNG and ETW tracing 2018-01-28 19:17:02 +00:00
qt.prf macOS: Explicitly link to debug version of framework when needed 2018-03-16 10:30:15 +00:00
resolve_config.prf Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
resolve_target.prf Merge remote-tracking branch 'origin/5.8' into dev 2017-01-25 20:06:06 +01:00
resources.prf qmake: fix immediate RESOURCES with absolute RCC_DIR 2018-02-20 13:53:40 +00:00
sanitizer.prf Add support for gcc/clang's sanitize features 2014-10-02 19:45:00 +02:00
silent.prf Fix CONFIG+=silent for MSVC non-inference rules 2017-07-14 18:49:56 +00:00
simd.prf simd.prf: Add support for compiling .c sources with the C compiler 2018-02-12 23:46:48 +00:00
spec_post.prf Qmake: Introduce and use QMAKE_{SYSTEM,SHELL}_NULL_DEVICE variable, take 2 2017-10-13 13:32:36 +00:00
spec_pre.prf factor out QMAKE_USE* processing to a separate prf file 2016-10-04 20:20:06 +00:00
static_runtime.prf Windows: Add -static-runtime configure option 2015-03-11 09:26:37 +00:00
testcase_targets.prf mkspecs: Add a benchmark "feature". 2016-03-02 21:24:54 +00:00
testcase.prf macOS: Allow tests to mark themselves as not supporting high-DPI 2018-03-14 17:37:34 +00:00
testcocoon.prf fix host vs. makefile directory separator mess 2012-07-28 00:09:45 +02:00
testlib_defines.prf Fixed compilation of auto tests using vc(x)proj files 2015-05-22 14:13:00 +00:00
toolchain.prf configure: during early setup, skip all of default_pre.prf 2017-12-14 18:06:07 +00:00
uic.prf uic: Add -no-stringliteral option 2017-08-03 09:59:15 +00:00
use_c_linker.prf Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
vxworks.prf Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
warn_off.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
warn_on.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
wayland-scanner.prf System library fix for wayland-scanner 2017-03-20 14:19:59 +00:00
xctest.prf Allow using Xcode Command Line Tools to build Qt 2017-06-29 02:00:12 +00:00
yacc.prf Merge remote-tracking branch 'origin/5.6' into 5.7 2016-11-04 11:39:15 +01:00