c4a6f974b1
Qt5 has predefined optimization flags depending if you're building for size, for debug etc. These flags are defined in mkspecs/common/gcc-base.conf: QMAKE_CFLAGS_OPTIMIZE = -O2 QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os Then, in the same file, they use them to set QMAKE_CFLAGS_RELEASE/QMAKE_CXXFLAGS_RELEASE: QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE At this point there is our chance to override QMAKE_CFLAGS_OPTIMIZE_* in qmake.conf, but it's too late, because QMAKE_CFLAGS_RELEASE is already set (i.e. -O2) so trying to add or remove QMAKE_CFLAGS_OPTIMIZE (that is reset now on) from QMAKE_CLAGS_RELEASE in common/features/default_post.prf won't work: optimize_size { !isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_SIZE) { QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_SIZE } } else: optimize_full { !isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_FULL) { QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL } } So let's reset: QMAKE_CFLAGS_RELEASE QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_RELEASE QMAKE_CXXFLAGS_DEBUG in our qmake.conf since the only assignment done in mkspecs/common/gcc-base.conf only regards optimization. This package is also affected by BR2_TOOLCHAIN_HAS_GCC_BUG_90620 and it's been worked around by appending -O0 to CFLAGS/CXXFLAGS. This bug prevented workaround to work overriding optimization flags, so solving this also solves workaround problem. Fixes: http://autobuild.buildroot.net/results/ada/adaa9b4bcc6f9d2b5e82c479859a07e8abf5cf13/ http://autobuild.buildroot.net/results/a83/a83bdd1f3bf309c07abebe871b017c331ed36e67/ Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Tested-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> [Arnout: add a comment to qmake.conf.in] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
39 lines
1.2 KiB
Plaintext
39 lines
1.2 KiB
Plaintext
# Qt5 has a mechanism to support "device" profiles, so that people can
|
|
# specify the compiler, compiler flags and so on for a specific device.
|
|
|
|
# We leverage this mechanism in the Buildroot packaging of qt5 to
|
|
# simplify cross-compilation: we have our own "device" definition, which
|
|
# allows us to easily pass the cross-compiler paths and flags from our
|
|
# qt5.mk.
|
|
|
|
include(../common/linux_device_pre.conf)
|
|
|
|
# modifications to g++-unix.conf
|
|
QMAKE_CC = $${CROSS_COMPILE}gcc
|
|
QMAKE_CXX = $${CROSS_COMPILE}g++
|
|
|
|
# modifications to gcc-base.conf
|
|
QMAKE_CFLAGS += $${BR_COMPILER_CFLAGS}
|
|
QMAKE_CXXFLAGS += $${BR_COMPILER_CXXFLAGS}
|
|
# Remove all optimisation flags, we really only want our own.
|
|
QMAKE_CFLAGS_OPTIMIZE =
|
|
QMAKE_CFLAGS_OPTIMIZE_DEBUG =
|
|
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
|
QMAKE_CFLAGS_OPTIMIZE_SIZE =
|
|
QMAKE_CFLAGS_DEBUG =
|
|
QMAKE_CXXFLAGS_DEBUG =
|
|
QMAKE_CFLAGS_RELEASE =
|
|
QMAKE_CXXFLAGS_RELEASE =
|
|
CONFIG += nostrip
|
|
|
|
QMAKE_LIBS += -lrt -lpthread -ldl
|
|
QMAKE_CFLAGS_ISYSTEM =
|
|
|
|
# Architecture specific configuration
|
|
include(arch.conf)
|
|
|
|
@EGLFS_DEVICE@
|
|
|
|
include(../common/linux_device_post.conf)
|
|
load(qt_config)
|