TipsAndTricks/Running YP binaries on Ubuntu and Vice Versa

From Yocto Project
Revision as of 23:22, 23 March 2017 by Bavery (talk | contribs)
Jump to navigationJump to search

Fun with moving things between os's!

Note: This is a hack to allow you to do some interesting things for experimental purposes. There are a large number of undiscovered ways this can fail. Use at your own risk :).

So, you want to run your ubuntu binary on qemux86-64 built with YP

  • We'll assume that the binary of interest is gawk. Chosen pretty randomly...
  • I will call the ubuntu native gawk gawk-ubuntu. I got it by cp /usr/bin/gawk ~/gawk-ubuntu
  • If I scp the gawk-ubuntu onto qemux86-64 and try to run it, I get the following:

root@qemux86-64:~# ./gawk-ubuntu   
-sh: ./gawk-ubuntu: No such file or directory  

  • so, what does this mean? It means that the dynamic loader ("ELF interpreter") for the ubuntu binary "knows" what it is looking for and is not finding it on the qemux86-64 system. So, how can we "fix" this. I have 2 different ways.
    • Path 1: add patchelf to your qemux86-64 image, and use it to change the interpreter that gawk-ubuntu is looking for. Do this by
 $ patchelf --set-interpreter /lib/my-ld-linux.so.2 my-program