<?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>8173</bug_id>
          
          <creation_ts>2015-08-17 08:36:38 +0000</creation_ts>
          <short_desc>Wrong dynamic loader because of missing -mfloat-abi=hard in LDFLAGS (in scons)</short_desc>
          <delta_ts>2017-04-02 21:32:12 +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>1.8.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tasskjapp">tasskjapp</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>benjamin.esquivel</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</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>53140</commentid>
    <comment_count>0</comment_count>
    <who name="Tasskjapp">tasskjapp</who>
    <bug_when>2015-08-17 08:36:38 +0000</bug_when>
    <thetext>I compiled a console image and an sdk for Jetson TK1. The sdk was generated with &quot;bitbake -cpopulate_sdk console-image&quot;.

Binaries compiled with the sdk failed with: &quot;./tstapp: No such file or directory&quot;. Doing &quot;readelf -a&quot; on the binary revealed that it was looking for  /lib/ld-linux.so.3, while my target (and sdk) had /lib/ld-linux-armhf.so.3.

Adding -mfloat-abi=hard to LDFLAGS solved it.

I suspect this linker option should have made it into the &quot;export LDFLAGS&quot; line in the environment setup of the sdk.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53273</commentid>
    <comment_count>1</comment_count>
    <who name="Benjamin Esquivel">benjamin.esquivel</who>
    <bug_when>2015-08-20 14:49:53 +0000</bug_when>
    <thetext>Isn&apos;t this something that the configuration should have picked up? I&apos;m saying this because I recently fixed an issue in glibc where the config was picking up the wrong setting for hard-float ABI at the configure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54111</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-09-15 19:58:53 +0000</bug_when>
    <thetext>Can you give more of an example of how you ended up linking a binary like this? I tried a test with beaglebone and the SDK locally and the environment file lists:

CC=&quot;arm-poky-linux-gnueabi-gcc  -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=$SDKTARGETSYSROOT&quot;

so if you use $CC, you get the right option to gcc. You can&apos;t be using $LD since that wouldn&apos;t accept -mfloat-abi as an option. If you&apos;re not using $CC, you can&apos;t be getting the --sysroot or other important options.

Basically, I need more information about how to reproduce this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54764</commentid>
    <comment_count>3</comment_count>
    <who name="Tasskjapp">tasskjapp</who>
    <bug_when>2015-09-29 05:44:14 +0000</bug_when>
    <thetext>Sorry for the late reply. Busy at work, so I haven&apos;t had a chance to look at this.

I use SCons. There you set up a build environment where you specify e.g. CC and LD and their flags. I took info from the environment setup and used the following flags.

# common (c/c++) flags
ccflags = [
    &apos;-march=armv7-a&apos;,
    &apos;-mthumb&apos;,
    &apos;-mthumb-interwork&apos;,
    &apos;-mfloat-abi=hard&apos;,
    &apos;-mfpu=neon&apos;,
    &apos;-mtune=cortex-a15&apos;,
    &apos;-pipe&apos;,
    &apos;-g&apos;,
    &apos;-feliminate-unused-debug-types&apos;,
    &apos;--sysroot=&apos; + armsysroot]

# specific c, c++ flags
cflags = [&apos;-std=gnu99&apos;, &apos;-Wshadow&apos;]
cxxflags = [&apos;-std=c++0x&apos;, &apos;-Wno-psabi&apos;]

# link flags and paths
ldflags = [
    &apos;-pthread&apos;,
    &apos;-g3&apos;,
    &apos;-Wl,-O1&apos;,
    &apos;-Wl,--hash-style=gnu&apos;,
    &apos;-Wl,--as-needed&apos;,
    &apos;--sysroot=&apos; + armsysroot]

My SCons build first compiles all the c/c++ files, and then links with LD. I had to add &apos;-march=armv7-a&apos; to the ldflags list to get a working binary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54973</commentid>
    <comment_count>4</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2015-10-05 21:01:27 +0000</bug_when>
    <thetext>I believe he has answered the question.  Please put it back in NEEDINFO if that is not the case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60595</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-03-31 13:36:02 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; My SCons build first compiles all the c/c++ files, and then links with LD. I
&gt; had to add &apos;-march=armv7-a&apos; to the ldflags list to get a working binary.

Sorry, I&apos;m confused. You had to add &apos;-mfloat-abi=hard&apos; or  &apos;-march=armv7-a&apos; or both?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60596</commentid>
    <comment_count>6</comment_count>
    <who name="Tasskjapp">tasskjapp</who>
    <bug_when>2016-03-31 13:48:37 +0000</bug_when>
    <thetext>No wonder you&apos;re confused. I only added -mfloat-abi=hard, so my previous comment was wrong. Sorry.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71999</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-04-02 21:32:12 +0000</bug_when>
    <thetext>Sorry for the delay in getting back to this. I think the clue here is that your LDFLAGS contain -Wl options which mean that they&apos;re being passed to gcc as the driver to the linker, not caling ld directly. If you&apos;re using gcc as the driver to the linker, you also need to add CFLAGS to LDFLAGS as you&apos;ve discovered. Most environments add in LDFLAGS to CFLAGS when linking, it appears scons doesn&apos;t and you therefore need to do that yourself.

I&apos;m not sure there is much we can do about this from the project side, the same LDFLAGS are what we use for building all our software and we can&apos;t really change that. I&apos;m going to have to mark this as WONFIX buts more CANTFIX, sorry :(</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>