<?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>10129</bug_id>
          
          <creation_ts>2016-08-11 21:54:50 +0000</creation_ts>
          <short_desc>gcc-runtime fails to build if libunwind in sysroot with musl</short_desc>
          <delta_ts>2016-08-24 15:35:02 +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.2</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>2.2 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>anibal.limon</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>raj.khem</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</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>65110</commentid>
    <comment_count>0</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-08-11 21:54:50 +0000</bug_when>
    <thetext>Full log on [1] and also attached. musl toolchain is failing when compiling gcc-runtime:

| Makefile:653: recipe for target &apos;eh_type.lo&apos; failed
| make[2]: *** [eh_type.lo] Error 1
| make[2]: Leaving directory &apos;/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-musl/build/build/tmp/work/i586-poky-linux-musl/gcc-runtime/6.1.1-r0/gcc-6.1.1/build.i586-poky-linux-musl.i586-poky-linux-musl/i586-poky-linux-musl/libstdc++-v3/libsupc++&apos;
| Makefile:507: recipe for target &apos;all-recursive&apos; failed
| make[1]: *** [all-recursive] Error 1
| make[1]: Leaving directory &apos;/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-musl/build/build/tmp/work/i586-poky-linux-musl/gcc-runtime/6.1.1-r0/gcc-6.1.1/build.i586-poky-linux-musl.i586-poky-linux-musl/i586-poky-linux-musl/libstdc++-v3&apos;
| Makefile:414: recipe for target &apos;all&apos; failed
| make: *** [all] Error 2
| ERROR: Function failed: do_compile (log file is located at /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-musl/build/build/tmp/work/i586-poky-linux-musl/gcc-runtime/6.1.1-r0/temp/log.do_compile.6101)
NOTE: recipe gcc-runtime-6.1.1-r0: task do_compile: Failed
ERROR: Task /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-musl/build/meta/recipes-devtools/gcc/gcc-runtime_6.1.bb:do_compile (/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-musl/build/meta/recipes-devtools/gcc/gcc-runtime_6.1.bb:do_compile) failed with exit code &apos;1&apos;
NOTE: recipe gdb-cross-i586-7.11-r0: task do_fetch: Succeeded

[1] https://autobuilder.yoctoproject.org/main/builders/nightly-musl/builds/212</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65193</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-08-15 15:06:04 +0000</bug_when>
    <thetext>Log wasn&apos;t attached.  I think http://errors.yoctoproject.org/Errors/Details/74601/ is the right one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65194</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-08-15 15:24:20 +0000</bug_when>
    <thetext>You can replicate this on demand:

TCLIBC=musl
bitbake libunwind
bitbake gcc-runtime -C configure</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65198</commentid>
    <comment_count>3</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2016-08-15 17:45:48 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; You can replicate this on demand:
&gt; 
&gt; TCLIBC=musl
&gt; bitbake libunwind
&gt; bitbake gcc-runtime -C configure

It sounds to similar build issue we have had while compiling gcc for target on musl.
Issue here is that there are two unwind.h files. One coming from libunwind which is staged into /usr/include and another one is from gcc itself, which is also staged under gcc&apos;s include and fixed-include directories. When we build any of gcc components they expect to use internal version and that works with glibc based gcc since the search headers first look into gcc headers, however with musl the gcc headers are searched after the standard headers ( which is by design the right thing )

The problem however, then becomes that as soon as libunwind it staged it starts getting the wrong header where as it has been configured to use gcc&apos;s header

This should be fixed in gcc sources itself, where it ensures that right header is included when its building itself and does not rely on compiler&apos;s paths to do the right thing.

A short term solution could be to add a build time gcc-runtime dep to libunwind recipe
so we are sure that gcc-runtime is built and staged before libunwind is built.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65289</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-08-18 11:04:29 +0000</bug_when>
    <thetext>Sadly, a dependency isn&apos;t enough. The system can install libunwind from sstate before gcc-runtime builds since there is no target do_populate_sysroot interdependency, nor should their be.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65484</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-08-24 15:35:02 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=b360310798a30900cc1d398da089bd1a94f20b50</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>