4 Replies Latest reply on Aug 11, 2014 2:36 AM by Annie_G

    [Newbie] Binary compiled with ADT not working on Galileo




      I am running Yocto on the Galileo and am trying to cross compile an application (using the ADT toolchain) from Ubuntu to run on the board. I compiled it for a 32 bit architecture and "scp"ed the binary onto the board.


      The problem I'm having is that Yocto says file not found if I try to run ./hello ("hello" is the name of the executable), but if I do ls -al, it does list the file:

      root@clanton:~# ls -al

      -rwxr-xr-x1 rootroot     7159 Jan  1 00:04 hello


      root@clanton:~# ./hello

      -sh: ./hello: No such file or directory


      if I look up the file on my host system, it does show that the file is compiled for a 32 bit architecture:

      $ file hello

      hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x261723c2a7fa5adacf0b9e6fab654dbe5dba779d, not stripped


      From online resources, I found that this problem occurs when you try to run a 32 bit executable on a 64 bit architecture, but the Galileo is a 32 bit architecture? Another interesting thing is that if the file hello is compiled for x86_64, running ./hello says it cannot execute the binary (in this case, it does find the binary).

      root@clanton:~# ./hello

      -sh: ./hello: cannot execute binary file


      Will someone be able to shed some light on this?


        • 1. Re: [Newbie] Binary compiled with ADT not working on Galileo

          what does "ldd hello" say?

          • 2. Re: [Newbie] Binary compiled with ADT not working on Galileo

            ldd for the 32 bit version returns:

            $ ldd hello32

            linux-gate.so.1 =>  (0xf777c000)

            libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75b5000)

            /lib/ld-linux.so.2 (0xf777d000)


            for the 64 bit version:

            $ ldd hello64

            linux-vdso.so.1 =>  (0x00007fffc03fe000)

            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbf5ac88000)

            /lib64/ld-linux-x86-64.so.2 (0x00007fbf5b064000)

            • 3. Re: [Newbie] Binary compiled with ADT not working on Galileo

              I guess I misunderstood.

              My understanding was: You are running a Yocto Linux on Galileo and you are cross compiling for that Linux and you are trying to run the generated executable "hello" on Galileo.

              - if you are cross-compiling for Galileo you will not get a 64 bit executable

              - if your are checking "ldd hello" on Galileo you wouldn't see the libs for 64 bit

              moreover you should see the libs in /lib/ not in /lib/<arch>/


              So I'm honestly slightly puzzled what you are doing and trying to attempt. Could you pls clarify?

              • 4. Re: [Newbie] Binary compiled with ADT not working on Galileo

                Your understanding was correct! My last post was probably a bit ambiguous.


                The ldd command isn't recognised on the Galileo (apparently the image I flashed onto it is missing the packages). I'm reflashing a new image on the board, which might solve the problem.


                The libraries returned above were from my dev machine and not the Galileo. I compiled the 64 bit executable because, as I explained in my first post, the Yocto is able to find the 64 bit version if I try to execute it, just says that it can't execute the binary whereas for the 32 bit version it says it cannot find the file if I try to execute it.


                I hope this post makes more sense than my earlier one did, and I'll post an update as soon as I reflash the image.