How does Qt Creator compose the invocation of gcc/g++?
-
Cross compiling an app for arm in Qt 5.15 with Qt Creator 4.5.2, i am trying to remove the -O2 optimization flag from the relase build g++ call; i need to remove it as i want to test a build using -Ofast instead, but the problem is that my flag gets inserted before the already present one and is therefore ignored.
I have checked all the Environment variables set for my project build, and removed "-O2" from all those which contained it; the variables which used to contain the flag are the following:
CXXFLAGS
QMAKE_CXXFLAGS
OE_QMAKE_CXXFLAGSI have also added the following to my project file
QMAKE_CXXFLAGS -= -O2 QMAKE_CXXFLAGS += -Ofast
and i can see the -Ofast flag is added to the compiler call, which follows
arm-poky-linux-gnueabi-g++ -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -c -pipe --sysroot=/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -Ofast -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_NO_DEBUG -DQT_PDFWIDGETS_LIB -DQT_WIDGETS_LIB -DQT_PDF_LIB -DQT_GUI_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB -I. -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtPdfWidgets -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtWidgets -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtPdf -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtGui -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtSerialPort -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include/QtCore -I. -I. -I/opt/eng-imx-fb/5.10-gatesgarth/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/lib/mkspecs/linux-oe-g++ -o main.o main.cpp
I couldn't find in the Qt Creator documentation how is this call to g++ created, for instance i also don't understand where all the includes are specified, as there is no environment variable associated to them, just this line
QT += core gui widgets serialport pdfwidgets
at the top of the project file.
Can anyone point me to the relvant docs, if such exist, or provide clues on where to look next?
-
This has nothing to do with QtCreator but with your build system (qmake in your case). All qmake vvariables can be found here: https://doc.qt.io/qt-6/qmake-variable-reference.html
-
@Christian-Ehrlicher Thanks! I was able to solve my issue with this.
As you may have guessed, i am not completely aware of what goes on behind the scense with this IDE, and also not very familiar with make/cmake/qmake in general. -
-
@Christian-Ehrlicher Albeit i was able to solved the specific issue i was having, is there a way to determine what the call to the compiler will look like?
Can i find this somewhere in the IDE, or the compiler call is simply a result of what qmake does when parsing the .pro file? -
You can take a look into the generated Makefile