<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>6573</bug_id>
          
          <creation_ts>2014-07-25 00:14:23 +0000</creation_ts>
          <short_desc>meta-toolchain-qte: Cannot be used to produce &quot;Debug&quot; and &quot;Release&quot; builds of Qt application outside Yocto buildsystem</short_desc>
          <delta_ts>2017-06-20 11:08:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>1.6.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marek Vasut">marek.vasut</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>44686</commentid>
    <comment_count>0</comment_count>
    <who name="Marek Vasut">marek.vasut</who>
    <bug_when>2014-07-25 00:14:23 +0000</bug_when>
    <thetext>I built Yocto 1.6.1 target &apos;meta-toolchain-qte&apos;, 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 &quot;release&quot; and &quot;debug&quot;:

RELEASE:

$ cd release/qttest/ ; qmake &quot;CONFIG += release&quot; ; 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 &quot;CONFIG += debug&quot; ; 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&apos;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=&quot; -O2 -pipe -g -feliminate-unused-debug-types&quot;
export CXXFLAGS=&quot; -O2 -pipe -g -feliminate-unused-debug-types&quot;
export LDFLAGS=&quot;-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed&quot;
export OE_QMAKE_CFLAGS=&quot;$CFLAGS&quot;
export OE_QMAKE_CXXFLAGS=&quot;$CXXFLAGS&quot;
export OE_QMAKE_LDFLAGS=&quot;$LDFLAGS&quot;

The problem is, that the CFLAGS etc contain -O2 -g unconditionally. Subsequently, the OE_QMAKE_CFLAGS=&quot;$CFLAGS&quot; etc picks all those flags into the Qt application builds unconditionally. Therefore, independently if what I selected by &apos;qmake &quot;CONFIG += {debug,release}&quot;&apos; , 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44714</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2014-07-25 15:39:33 +0000</bug_when>
    <thetext>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&apos;m no qt expert...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44716</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Bénard">eric</who>
    <bug_when>2014-07-25 16:15:03 +0000</bug_when>
    <thetext>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 &quot;-O2 -pipe -g -feliminate-unused-debug-types&quot; is added in both
case thus introducing debug symbols in the release one and I assume
this comes from these env variables.

Thanks,</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44740</commentid>
    <comment_count>3</comment_count>
      <attachid>2060</attachid>
    <who name="Marek Vasut">marek.vasut</who>
    <bug_when>2014-07-27 05:59:17 +0000</bug_when>
    <thetext>Created attachment 2060
[PATCH] Yocto: qt4: Let qmake control some compiler/linker flags</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44741</commentid>
    <comment_count>4</comment_count>
    <who name="Marek Vasut">marek.vasut</who>
    <bug_when>2014-07-27 06:00:16 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Marek : may you please try to unexport OE_QMAKE_CFLAGS
&gt; OE_QMAKE_CXXFLAGS and OE_QMAKE_LDFLAGS after sourcing the env script to
&gt; see if that fix your problem ?
&gt; 
&gt; It seems &quot;-O2 -pipe -g -feliminate-unused-debug-types&quot; is added in both
&gt; case thus introducing debug symbols in the release one and I assume
&gt; this comes from these env variables.
&gt; 
&gt; Thanks,

Yes, this is where it comes from. I attached a patch which solves the issue.

Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51006</commentid>
    <comment_count>5</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-05-14 15:30:13 +0000</bug_when>
    <thetext>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&apos;re stuck with the status quo unless someone can come up with a solution that satisfies both sides.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74376</commentid>
    <comment_count>6</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-06-20 11:08:35 +0000</bug_when>
    <thetext>We&apos;re not really actively maintaining meta-qt4 these days and Qt4 is unmaintained upstream as well, so marking as WONTFIX.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2060</attachid>
            <date>2014-07-27 05:59:17 +0000</date>
            <delta_ts>2014-07-27 05:59:17 +0000</delta_ts>
            <desc>[PATCH] Yocto: qt4: Let qmake control some compiler/linker flags</desc>
            <filename>0001-Yocto-qt4-Let-qmake-control-some-compiler-linker-fla.patch</filename>
            <type>text/plain</type>
            <size>2419</size>
            <attacher name="Marek Vasut">marek.vasut</attacher>
            
              <data encoding="base64">RnJvbSA4YjkxZDUxMjMzOGE2NWQ5NWIyMWU3Mzc1NjUzZGE1MTU4ZWIzYmUxIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXJlayBWYXN1dCA8bWFyZXhAZGVueC5kZT4KRGF0ZTogU3Vu
LCAyNyBKdWwgMjAxNCAwNzo0MDoyM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