<?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>11769</bug_id>
          
          <creation_ts>2017-07-06 18:20:25 +0000</creation_ts>
          <short_desc>SDK environment-setup CXXFLAGS wrong</short_desc>
          <delta_ts>2017-11-09 07:11:11 +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>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>2.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.4 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Juro Bystricky">juro.bystricky</reporter>
          <assigned_to name="Rebecca Chang">rebecca.swee.fun.chang</assigned_to>
          <cc>brian.avery</cc>
    
    <cc>ee.peng.yeoh</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
    
    <cc>shashwatx.pandey</cc>
          
          <qa_contact name="nagarajagopal">nagarajagopalx.velu</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>Regression (Used to work)</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>74846</commentid>
    <comment_count>0</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-07-06 18:20:25 +0000</bug_when>
    <thetext>I just built an SDK:

$ bitbake core-image-minimal -cpopulate_sdk


The SDK environment file contains this:

export CXXFLAGS=&quot;${BUILDSDK_CXXFLAGS}&quot;

This does not seem right. There is no definition of BUILDSDK_CXXFLAGS anywhere.
FWIW bitbake.conf has definitions for BUILDSDK_CPPFLAGS, BUILDSDK_CFLAGS but no definition for BUILDSDK_CXXFLAGS.

I filed this as a regression, as in the past I got:

export CXXFLAGS=&quot; -O2 -pipe -g -feliminate-unused-debug-types &quot;

(Same as CFLAGS)

The version info is :
Distro: poky
Distro Version: 2.3
Metadata Revision: 754c03006943a219ffd417c36ab909b464f57f67
Timestamp: 20170706170246</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75000</commentid>
    <comment_count>1</comment_count>
    <who name="brian avery">brian.avery</who>
    <bug_when>2017-07-13 14:44:01 +0000</bug_when>
    <thetext>as part of fixing this, could we add a sdk test for all the sdk variables to make sure they expand to something?  There&apos;s already a couple of sdk tests so extending them is not too bad.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75977</commentid>
    <comment_count>2</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-18 03:14:24 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; I filed this as a regression, as in the past I got:
&gt; 
&gt; export CXXFLAGS=&quot; -O2 -pipe -g -feliminate-unused-debug-types &quot;
&gt; 
&gt; (Same as CFLAGS)
&gt; 
&gt; The version info is :
&gt; Distro: poky
&gt; Distro Version: 2.3
&gt; Metadata Revision: 754c03006943a219ffd417c36ab909b464f57f67
&gt; Timestamp: 20170706170246

Hi Juro,
I have checkout to Metadata Revision: 754c03006943a219ffd417c36ab909b464f57f67 and tried to build a sdk from the revision mentioned above.
But I&apos;m still getting no definition for CXXFLAGS:
export CXXFLAGS=&quot;${BUILDSDK_CXXFLAGS}&quot;

So I suspect it might have been broken even earlier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75990</commentid>
    <comment_count>3</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-08-18 16:03:58 +0000</bug_when>
    <thetext>I checked some older SDKs installed on my machine, so this one is OK (buid with MACHINE=&quot;qemuarm&quot;:

Distro: poky
Distro Version: 2.2+snapshot-20170225
Metadata Revision: 3c83b56309ab419f8cda72c0711479f60f61439a
Timestamp: 20170225001909

It has:
export CXXFLAGS=&quot; -O2 -pipe -g -feliminate-unused-debug-types &quot;

Then I have one:
Distro: poky
Distro Version: 2.3
Metadata Revision: f2b91c6e00c5a6de8ef0ac51f9f07e53d1ca9d43
Timestamp: 20170504192226

which is broken (I did not notice this at the time):
export CXXFLAGS=&quot;${BUILDSDK_CXXFLAGS}&quot;

I also checked the official yocto releases:
http://downloads.yoctoproject.org/releases/yocto/

Distro: poky
Distro Version: 2.3.1
Metadata Revision: c2ef32ae58737463cf19aab7446d6a30ad81754f
Timestamp: 20170712013505

and the bug is there as well, so it is in 2.3

Distro: poky
Distro Version: 2.3
Metadata Revision: 381897c64069ea43d595380a3ae913bcc79cf7e1
Timestamp: 20170501163737
export CXXFLAGS=&quot;${BUILDSDK_CXXFLAGS}&quot;


This one (2.2.1) is OK:
Distro: poky
Distro Version: 2.2.1
Metadata Revision: 6a1f33cc40bfac33cf030fe41e1a8efd1e5fad6f
Timestamp: 20170208201852
export CXXFLAGS=&quot; -O2 -pipe -g -feliminate-unused-debug-types &quot;


I only randomly checked some SDKs (extended &amp; standard), but I think it is fairly safe to state that 2.2 is OK and 2.3 is broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76020</commentid>
    <comment_count>4</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-21 07:11:16 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; I only randomly checked some SDKs (extended &amp; standard), but I think it is
&gt; fairly safe to state that 2.2 is OK and 2.3 is broken.

Thanks Juro, I was also building a few SDK on the major milestone tags to check.
Given that you have narrow down to between 2.2 and 2.3, I will start bisecting from here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76048</commentid>
    <comment_count>5</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-22 08:33:55 +0000</bug_when>
    <thetext>Git bisecting went bad from commit 863b6d4f80869b0388fd9ef5c0ead38993c3b2b5
(cross-canadian.bbclass: override TARGET_* flags).

CXXFLAGS in SDK environment file is not set correctly at this point.

I did a grep on Poky, BUILDSDK_* flags was set in both:
meta/classes/cross-canadian.bbclass:TARGET_CXXFLAGS = &quot;${BUILDSDK_CXXFLAGS}&quot;
meta/classes/nativesdk.bbclass:TARGET_CXXFLAGS = &quot;${BUILDSDK_CXXFLAGS}&quot;

I think this is how BUILDSDK_CXXFLAGS came about and we are lack of definition of BUILDSDK_CXXFLAGS in bitbake.conf.

I&apos;m proposing adding definition to BUILDSDK_CXXFLAGS in bitbake.conf.

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 3110b9c..8ce6c9f 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -542,6 +542,7 @@ export CFLAGS = &quot;${TARGET_CFLAGS}&quot;
 export TARGET_CFLAGS = &quot;${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}&quot;
 
 export BUILD_CXXFLAGS = &quot;${BUILD_CFLAGS}&quot;
+BUILDSDK_CXXFLAGS = &quot;${BUILDSDK_CFLAGS}&quot;
 export CXXFLAGS = &quot;${TARGET_CXXFLAGS}&quot;
 export TARGET_CXXFLAGS = &quot;${TARGET_CFLAGS}&quot;

By referring to BUILDSDK_CFLAGS, it has a definition in bitbake.conf.
This is how I came about adding a definition for BUILDSDK_CXXFLAGS.

Any comments?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76308</commentid>
    <comment_count>6</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-30 05:15:59 +0000</bug_when>
    <thetext>Submitted patch to mailing list for review.

http://lists.openembedded.org/pipermail/openembedded-core/2017-August/141587.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76486</commentid>
    <comment_count>7</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-09-04 00:18:30 +0000</bug_when>
    <thetext>OE-Core rev: 073ca1cbd1b70d5b36618584a8c88cbba391a259</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77537</commentid>
    <comment_count>8</comment_count>
    <who name="nagarajagopal">nagarajagopalx.velu</who>
    <bug_when>2017-10-12 06:45:09 +0000</bug_when>
    <thetext>
Verification logs:

1) Checkout to master branch

2) Check SDK toolchain installed in machine. 

3) Check environment setup file configured as &quot; export CXXFLAGS= -O2 -pipe -g -feliminate-unused-debug-types &quot;

4) Crosscheck &quot;export CFLAGS&quot; and &quot;export CXXFLAGS&quot; configure should be same.

5) Below find build configuration,

Build Configuration:
BB_VERSION        = &quot;1.35.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;universal&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.4&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;

6) compile the test CPP file and should compile without error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77779</commentid>
    <comment_count>9</comment_count>
    <who name="nagarajagopal">nagarajagopalx.velu</who>
    <bug_when>2017-10-24 01:17:09 +0000</bug_when>
    <thetext>  Verification log ,
  
   clone poky
   source oe-init-build-env
   bitbake core-image-minimal -cpopulate_sdk
   Install SDK
   setup source the SDK environment,
   . /home/raj/SDK_test_cpp/environment-setup-i586-poky-linux
   compile test CPP code,
   ${CXX} ${CXXFLAGS} testplus.cpp -o test
   It should pass all the time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78094</commentid>
    <comment_count>10</comment_count>
    <who name="Shashwat Pandey">shashwatx.pandey</who>
    <bug_when>2017-11-09 07:11:11 +0000</bug_when>
    <thetext>Verified, issue is fixed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>