| Summary: | meta-toolchain-qte: Cannot be used to produce "Debug" and "Release" builds of Qt application outside Yocto buildsystem | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Meta-yocto | Reporter: | Marek Vasut <marek.vasut> | ||||
| Component: | meta-yocto | Assignee: | Unassigned <unassigned> | ||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Low | CC: | bluelightning, poky.bs.watcher, poky.watcher, sgw | ||||
| Version: | 1.6.1 | ||||||
| Target Milestone: | Future | ||||||
| Hardware: | x86 | ||||||
| OS: | arm | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||
| Attachments: |
|
||||||
Looks like this was introduced by http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/recipes-qt/meta?id=8575c864d4a15180fb9aeac6a4000c8a3548e05f Reassigning to Eric in the hope you can figure this out between you. I'm no qt expert... Marek : may you please try to unexport OE_QMAKE_CFLAGS OE_QMAKE_CXXFLAGS and OE_QMAKE_LDFLAGS after sourcing the env script to see if that fix your problem ? It seems "-O2 -pipe -g -feliminate-unused-debug-types" is added in both case thus introducing debug symbols in the release one and I assume this comes from these env variables. Thanks, Created attachment 2060 [details]
[PATCH] Yocto: qt4: Let qmake control some compiler/linker flags
(In reply to comment #2) > Marek : may you please try to unexport OE_QMAKE_CFLAGS > OE_QMAKE_CXXFLAGS and OE_QMAKE_LDFLAGS after sourcing the env script to > see if that fix your problem ? > > It seems "-O2 -pipe -g -feliminate-unused-debug-types" is added in both > case thus introducing debug symbols in the release one and I assume > this comes from these env variables. > > Thanks, Yes, this is where it comes from. I attached a patch which solves the issue. Thank you! To keep the status of this updated, when the patch got sent to the mailing list there was some disagreement over the proposed fix: http://patchwork.openembedded.org/patch/77473/ At the moment I think we're stuck with the status quo unless someone can come up with a solution that satisfies both sides. We're not really actively maintaining meta-qt4 these days and Qt4 is unmaintained upstream as well, so marking as WONTFIX. |
I built Yocto 1.6.1 target 'meta-toolchain-qte', MACHINE=beaglebone . This produced tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-qte-cortexa8hf-vfp-neon-toolchain-qte-1.6.1.sh installation script with the toolchain. I installed the toolchain, which placed it into /opt/poky/1.6.1/ . With the toolchain installed, I wanted to test if I can compile a simple Qt application. I downloaded one from [1] and extracted this into two different directories: $ cd /tmp/ $ wget [1] $ mkdir {release,debug} $ tar -xzf qttest.tar.gz -C release $ tar -xzf qttest.tar.gz -C debug Now I sourced the toolchain environment so I can cross-compile the Qt application: $ . /opt/poky/1.6.1/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi Finally, I try to compile the Qt application for both "release" and "debug": RELEASE: $ cd release/qttest/ ; qmake "CONFIG += release" ; make ; cd ../../ /opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/uic4 mainwindow.ui -o ui_mainwindow.h arm-poky-linux-gnueabi-g++ -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi -c -pipe -pipe -pipe -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -O2 -O2 -Wall -W -Wall -W -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/share/qtopia/mkspecs/linux-g++ -I. -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia/QtCore -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia/QtGui -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia -I. -I. -o main.o main.cpp [...] arm-poky-linux-gnueabi-g++ -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-rpath-link,/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/lib -o qttest main.o mainwindow.o moc_mainwindow.o -L/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/lib -lQtGuiE -lQtNetworkE -lQtCoreE -lpthread DEBUG: $ cd debug/qttest/ ; qmake "CONFIG += debug" ; make ; cd ../../ /opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/uic4 mainwindow.ui -o ui_mainwindow.h arm-poky-linux-gnueabi-g++ -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi -c -pipe -pipe -pipe -O2 -pipe -g -feliminate-unused-debug-types -O2 -pipe -g -feliminate-unused-debug-types -g -g -g -Wall -W -Wall -W -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/share/qtopia/mkspecs/linux-g++ -I. -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia/QtCore -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia/QtGui -I/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/include/qtopia -I. -I. -o main.o main.cpp [...] arm-poky-linux-gnueabi-g++ -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-rpath-link,/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/lib -o qttest main.o mainwindow.o moc_mainwindow.o -L/opt/poky/1.6.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi//usr/lib -lQtGuiE -lQtNetworkE -lQtCoreE -lpthread Now let's inspect the properties of both resulting binaries: $ du -sb */qttest/qttest 343746 debug/qttest/qttest 342886 release/qttest/qttest $ file */qttest/qttest debug/qttest/qttest: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=6f1df5ca2883716875ce3039c98f0716c653da2d, not stripped release/qttest/qttest: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=2c0241249f5b3d8d101dd78e0fcefcd710014931, not stripped So both files are not stripped, both contain debug syms etc. I would _not_ expect a release build to contain debug symbols. Before Yocto 1.3, the RELEASE build of a Qt application indeed did not contain any debug symbols and was compiled with -O2 . The DEBUG build was compiled with -O0 -g , therefore was not optimized and contained debug symbols. This behavior changed in Yocto 1.3 . By inspecting the environment setup script for the toolchain, we see (shortened) these variables: export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types" export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types" export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed" export OE_QMAKE_CFLAGS="$CFLAGS" export OE_QMAKE_CXXFLAGS="$CXXFLAGS" export OE_QMAKE_LDFLAGS="$LDFLAGS" The problem is, that the CFLAGS etc contain -O2 -g unconditionally. Subsequently, the OE_QMAKE_CFLAGS="$CFLAGS" etc picks all those flags into the Qt application builds unconditionally. Therefore, independently if what I selected by 'qmake "CONFIG += {debug,release}"' , I will always get the -O2 -g etc CFLAGS because of the toolchain environment script. This was introduced in Yocto 1.3 , Yocto 1.2 worked perfectly fine. Is there any way I can get the old behavior, which allows me to build both release and debug builds , back please ? [1] http://www.denx.de/wiki/pub/ELDK-5/FrequentlyAskedQuestionsAndAnswers/qttest.tar.gz