2015-11-24 22:21:49 +01:00
|
|
|
# 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}
|
2019-11-25 12:26:14 +01:00
|
|
|
# Remove all optimisation flags, we really only want our own.
|
package/qt5/qt5base: build with correct optimization
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 common/features/default_post.prf, they add those flags to
QMAKE_CFLAGS_RELEASE/QMAKE_CXXFLAGS_RELEASE depending on various build
options (optimize_size, optimize_full, optimize_debug):
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
}
}
Since this default_post.prf is included *after* our qmake.conf file,
these flags override our optimizations flags, which is not good.
However, our qmake.conf file is included *after* gcc-base.conf, so we
can simply reset those variables to have the empty value, and our
optimization flags will be used.
Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
[Thomas: completely change the approach, by simply resetting the
QMAKE_CFLAGS_OPTIMIZE_* variables in qmake.conf]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-06-26 16:04:12 +02:00
|
|
|
QMAKE_CFLAGS_OPTIMIZE =
|
|
|
|
QMAKE_CFLAGS_OPTIMIZE_DEBUG =
|
|
|
|
QMAKE_CFLAGS_OPTIMIZE_FULL =
|
|
|
|
QMAKE_CFLAGS_OPTIMIZE_SIZE =
|
2019-11-25 12:26:14 +01:00
|
|
|
QMAKE_CFLAGS_DEBUG =
|
|
|
|
QMAKE_CXXFLAGS_DEBUG =
|
|
|
|
QMAKE_CFLAGS_RELEASE =
|
|
|
|
QMAKE_CXXFLAGS_RELEASE =
|
2015-11-24 22:21:49 +01:00
|
|
|
CONFIG += nostrip
|
|
|
|
|
|
|
|
QMAKE_LIBS += -lrt -lpthread -ldl
|
qt5: Disable passing of -isystem flag in CXXFLAGS
Some Qt5 sub-projects as well as 3rd-party apps written on Qt
are failing to compile with gcc 6.x like that:
---------------------------->8-------------------------
In file included from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/stl_algo.h:59:0,
from XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/algorithm:62,
from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qglobal.h:88,
from XXX/output/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/include/qt5/QtCore/qpair.h:37,
from qmediametadata.h:37,
from qmediametadata.cpp:28:
XXX/output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^
compilation terminated.
---------------------------->8-------------------------
That happens because qmake trying to play smart passes some
include paths in Makefile with "-isystem" prefix.
Which in some cases lead to build failure well described in [1].
A little bit more details below on what really happens:
1. In "configure" script Qt determines default include paths of the
toolchain and stores them in DEFAULT_INCDIRS variable, see [2].
2. On qmake execution when it creates Makefile out of .pro-file
it parses headers in INCLUDEPATH variable and if a path matches
one in DEFAULT_INCDIRS then in CXXFLAGS that path is written
with $QMAKE_CFLAGS_ISYSTEM prefix, otherwise non-matching include
path ends up in CXXFLAGS with normal "-I" prefix.
3. By default for gcc "QMAKE_CFLAGS_ISYSTEM = -isystem", see [3].
4. gcc fails to find stdlib.h, again refer to Jörg's explanation in [1].
What we do here we force set QMAKE_CFLAGS_ISYSTEM to "" and so qmake
won't use "-isystem" any longer instead expected "-I" will be used for
all headers, see [4].
That fixes building of Qt5Webkit on ARM with gcc 6.x and a number of
autobuilder failures for ARC (the an arch that uses gcc 6 by default) like:
http://autobuild.buildroot.net/results/56a/56a6700774af692e7f5a99b452b15e4e8592310f
http://autobuild.buildroot.net/results/697/697412b29bf031bf8f246cc3af97ebcbf6bf6d1b
[1] https://git.buildroot.net/buildroot/commit/?id=e79272fa7ff3d66c18de3514b912cd9d68d121a4
[2] http://code.qt.io/cgit/qt/qtbase.git/tree/configure?h=5.6.1#n3660
[3] http://code.qt.io/cgit/qt/qtbase.git/tree/mkspecs/common/gcc-base.conf?h=5.6.1#n47
[4] http://code.qt.io/cgit/qt/qtbase.git/tree/qmake/generators/unix/unixmake2.cpp?&h=5.6.1#n193
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Seiderer <ps.report@gmx.net>
Cc: Julien Corjon <corjon.j@ecagroup.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-09-23 16:58:49 +02:00
|
|
|
QMAKE_CFLAGS_ISYSTEM =
|
2015-11-24 22:21:49 +01:00
|
|
|
|
2018-06-30 08:29:27 +02:00
|
|
|
# Architecture specific configuration
|
2017-05-17 23:15:28 +02:00
|
|
|
include(arch.conf)
|
|
|
|
|
2017-11-13 19:41:54 +01:00
|
|
|
@EGLFS_DEVICE@
|
|
|
|
|
2015-11-24 22:21:49 +01:00
|
|
|
include(../common/linux_device_post.conf)
|
|
|
|
load(qt_config)
|