[yocto] Yocto doesn't recognize cross-compiled binaries inside SDK

Kun Yi kunyi at google.com
Fri Dec 2 00:36:24 PST 2016


Hello,

I'm trying to use SDK for an existing image to run cross-compiled code
on my host machine. My target is ARM and host is x86_64. The SDK has
arm-openbmc-linux-gnueabi toolchains installed. (The rationale is to
build and run C++ unit tests for the modules that I'm developing on
the host, but that's not relevant)

Reading Yocto 2.1 reference it seems that I should be able to
cross-compile binaries for arm inside the SDK shell and run the
binaries directly, yet even the simple hello-world example shown in
http://www.yoctoproject.org/docs/2.1/mega-manual/mega-manual.html#creating-and-running-a-project-based-on-gnu-autotools
 failed for me.

Step 1-9 complete without much issue, but doing ./hello inside the SDK
shell fails:

bash: ./hello: cannot execute binary file: Exec format error


"file hello" suggests it was built for ARM:

hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux
2.6.32, BuildID[sha1]=9d47644538b2bf26176bb4897d20b29e531aab59, not
stripped

"echo $CONFIGURE_FLAGS" gives:
--target=arm-openbmc-linux-gnueabi --host=arm-openbmc-linux-gnueabi
--build=x86_64-linux
--with-libtool-sysroot=$HOME/gbmc/sdk/2.1/sysroots/armv5e-openbmc-linux-gnueabi


Am I missing anything? Let me know if any other information is needed.

-- 
Regards,
Kun



More information about the yocto mailing list