<?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>5229</bug_id>
          
          <creation_ts>2013-09-18 14:16:22 +0000</creation_ts>
          <short_desc>qemu-arm points to the wrong lib path (host instead of target)</short_desc>
          <delta_ts>2013-09-18 15:55:00 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olivier Guiter">olivier.guiter</reporter>
          <assigned_to name="Laurentiu Palcu">laurentiu.palcu</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>36876</commentid>
    <comment_count>0</comment_count>
    <who name="Olivier Guiter">olivier.guiter</who>
    <bug_when>2013-09-18 14:16:22 +0000</bug_when>
    <thetext>Cannot run an armv5 file (generated with the Yocto SDK) on a x86_64 host because of wrong library paths search in qemu-arm

branch master sha1:5fca4d286eec240ad57d90defa43cd0ff24f88ed
host: Ubuntu 12.04 / Custom kernel 3.10 x86_64
target: default &quot;qemuarm&quot;

Steps:
default local.conf except:
    MACHINE ?= &quot;qemuarm&quot;
    IMAGE_FEATURES += &quot;package-management ssh-server-openssh&quot;

Build SDK from core-image-minimal:
    bitbake core-image-minimal
    bitbake -c populate_sdk core-image-minimal

&quot;runqemu qemuarm&quot; runs without any problem.

With SDK: 
i wrote a very simple hello.c
$echo $CC
  arm-poky-linux-gnueabi-gcc -march=armv5te -marm -mthumb-interwork --sysroot=/home/oguiter/Devel/Yocto/TestJCSDK/sysroots/armv5te-poky-linux-gnueabi

$CC hello.c hello
(i also did the test with &quot;make hello&quot;, same result)

file hello
 hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=0xfef9c9a4f293ed3b2f346671d1c630b92de4aca5, not stripped

The problem:
$qemu-arm hello
/lib/ld-linux.so.3: No such file or directory

if i copy ld-linux.so.3 from sdk directory to host/lib directory, qemu-arm find the file...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>36890</commentid>
    <comment_count>1</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-09-18 15:28:53 +0000</bug_when>
    <thetext>Actually, you have to tell qemu-arm where your target sysroot is, like so:

qemu-arm -L /home/oguiter/Devel/Yocto/TestJCSDK/sysroots/armv5te-poky-linux-gnueabi

It should be enough. Otherwise it will look for libraries in the standard library paths: /lib:/usr/lib.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>36891</commentid>
    <comment_count>2</comment_count>
    <who name="Olivier Guiter">olivier.guiter</who>
    <bug_when>2013-09-18 15:34:02 +0000</bug_when>
    <thetext>Thanks for the suggestion. It works with the -L option. Btw i would expect qemu-arm to &quot;guess&quot; the correct path...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>36896</commentid>
    <comment_count>3</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2013-09-18 15:52:17 +0000</bug_when>
    <thetext>Well, how can it guess it? The sysroot is not encoded into the final binary. So that you can move your app on the actual target and run it. The dynamic linker is the one who knows where to look for. So, the path to the dynamic linker is the one ending in the final binary in the INTERP section.

For example:

On target, when you issue ./hello command, the dynamic linker (/lib/ld-linux.so.3) is invoked and will start looking into /lib:/usr/lib for dependencies.

On host, when you run qemu-arm ./hello, it will also invoke the target&apos;s dynamic linker because it gets it from the binary (/lib/ld-linux.so.3) but, in this case, you must &quot;help&quot; qemu and tell it where the target sysroot is.

I believe this bug can be closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>36897</commentid>
    <comment_count>4</comment_count>
    <who name="Olivier Guiter">olivier.guiter</who>
    <bug_when>2013-09-18 15:55:00 +0000</bug_when>
    <thetext>Not a bug. Closed</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>