<?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>5347</bug_id>
          
          <creation_ts>2013-10-14 10:45:18 +0000</creation_ts>
          <short_desc>Cross-Development Toolchain doesn&apos;t support simple static binary build</short_desc>
          <delta_ts>2013-10-31 15:47:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>ADT</product>
          <component>adt</component>
          <version>1.5</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>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.6</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Maxin B. John (inactive)">maxin.baby.john</reporter>
          <assigned_to name="Laurentiu Palcu">laurentiu.palcu</assigned_to>
          <cc>poky.adt.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Done (doc changes complete)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37879</commentid>
    <comment_count>0</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-14 10:45:18 +0000</bug_when>
    <thetext></thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37880</commentid>
    <comment_count>1</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-14 10:49:22 +0000</bug_when>
    <thetext>I have created an SDK using the command:
#  bitbake core-image-minimal -c populate_sdk

Installed the cross toolchain for x86:
# sh poky-eglibc-x86_64-core-image-minimal-i586-toolchain-1.5.sh 
#  source /opt/poky/1.5/environment-setup-i586-poky-linux

Tried to use the toolchain to build a static binary:
# cat test-static.c 

#include &lt;stdio.h&gt;
int main()
{
 printf(&quot;Static \n&quot;);
 return 0;
}

#cat Makefile
all:
        ${CC} test-static.c -static -o test

# make
i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/1.5/sysroots/i586-poky-linux test.c -static -o test
/opt/poky/1.5/sysroots/x86_64-pokysdk-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.8.1/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make: *** [all] Error 1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37891</commentid>
    <comment_count>2</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-14 13:14:43 +0000</bug_when>
    <thetext>IMAGE_INSTALL_append = &quot; eglibc-staticdev&quot;

resolves this problem. Thanks to RP.

However, most of the cross-toolchains support &quot;static&quot; linking as a default behaviour. Can we follow the same path?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37914</commentid>
    <comment_count>3</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2013-10-14 20:21:05 +0000</bug_when>
    <thetext>Would documentation of this issue be sufficient? Depending on the use case most development environements will be using dynamic linking. I can see in the smaller footprints static linking might be useful, but that might be limited cases, we don&apos;t want to add the overhead of the static libraries to all the dev images (yet get quite large).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37919</commentid>
    <comment_count>4</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-15 08:09:58 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Would documentation of this issue be sufficient? 
I do agree.

&gt; Depending on the use case
&gt; most development environements will be using dynamic linking. I can see in
&gt; the smaller footprints static linking might be useful, but that might be
&gt; limited cases, we don&apos;t want to add the overhead of the static libraries to
&gt; all the dev images (yet get quite large).

Yes. Not everyone needs static linking.

Ideally, can we think of adding the minimum set of static libraries (libc, libc++) to the SDK ? Additional storage required for the static libraries are listed below (for arm):
# du -h *.a
116K    libanl.a
16K     libBrokenLocale.a
4.0K    libbsd-compat.a
17M     libc.a
72K     libc_nonshared.a
160K    libcrypt.a
36K     libdl.a
4.0K    libg.a
4.0K    libieee.a
2.3M    libm.a
12K     libmcheck.a
844K    libnsl.a
1.7M    libpthread.a
4.0K    libpthread_nonshared.a
444K    libresolv.a
228K    librpcsvc.a
296K    librt.a
9.7M    libstdc++.a
784K    libsupc++.a
36K     libutil.a

which is around 40M</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38077</commentid>
    <comment_count>5</comment_count>
      <attachid>1571</attachid>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-21 09:11:36 +0000</bug_when>
    <thetext>Created attachment 1571
Documentation fix

Added a Note about this in the adt manual.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38352</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2013-10-31 15:07:37 +0000</bug_when>
    <thetext>Hi, 

I took your patch and hand-applied it.  I did some technical writing on it so it is not verbatim.  You can examine the note here: http://www.yoctoproject.org/docs/1.6/adt-manual/adt-manual.html#optionally-building-a-toolchain-installer.

I flipped the &quot;Documentation change&quot; field to &quot;Done&quot;.  Let me know if the note works.

Here is the commit URL: http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/commit/?id=91409d77d68e55f4089cab3e7f48dd385dddff2e

Thanks, 
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38356</commentid>
    <comment_count>7</comment_count>
    <who name="Maxin B. John (inactive)">maxin.baby.john</who>
    <bug_when>2013-10-31 15:43:18 +0000</bug_when>
    <thetext>Hi,

(In reply to comment #6)
&gt; Hi, 
&gt; 
&gt; I took your patch and hand-applied it.  I did some technical writing on it
&gt; so it is not verbatim.  You can examine the note here:
&gt; http://www.yoctoproject.org/docs/1.6/adt-manual/adt-manual.html#optionally-
&gt; building-a-toolchain-installer.
&gt; 
&gt; I flipped the &quot;Documentation change&quot; field to &quot;Done&quot;.  Let me know if the
&gt; note works.

These changes looks much better. Thanks !
 
&gt; Here is the commit URL:
&gt; http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/commit/
&gt; ?id=91409d77d68e55f4089cab3e7f48dd385dddff2

I guess, We can change the status to &quot;Resolved&quot;.

&gt; Thanks, 
&gt; Scott

Thanks and Regards,
Maxin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38357</commentid>
    <comment_count>8</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2013-10-31 15:47:13 +0000</bug_when>
    <thetext>Nice... Thanks for the quick review!

Scott</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>1571</attachid>
            <date>2013-10-21 09:11:36 +0000</date>
            <delta_ts>2013-10-21 09:11:36 +0000</delta_ts>
            <desc>Documentation fix</desc>
            <filename>0001-adt-manual-Added-note-for-static-binary-build.patch</filename>
            <type>text/plain</type>
            <size>1299</size>
            <attacher name="Maxin B. John (inactive)">maxin.baby.john</attacher>
            
              <data encoding="base64">RnJvbSA0NmUzNDRmNjkxZGJiZmMyMWU2NmM2NDE5MDE0Mzk4MTNmZGZjOTdiIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiAiTWF4aW4gQi4gSm9obiIgPG1heGluLmpvaG5AZW5lYS5jb20+
CkRhdGU6IE1vbiwgMjEgT2N0IDIwMTMgMTE6MDA6MjIgKzAyMDAKU3ViamVjdDogW1BBVENIXSBh
ZHQtbWFudWFsOiBBZGRlZCBub3RlIGZvciBzdGF0aWMgYmluYXJ5I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