Did you try compiling in text mode?

$  $CC -o test test.c

--
Pierre FICHEUX -/- CTO Smile-ECS, France -\- [email protected]
                                    http://www.smile.fr
                                    http://ingenierie.openwide.fr
I would love to change the world, but they won't give me the source code

Le 2017-07-02 03:07, Paul D. DeRocco a écrit :
From: Andrea Galbusera [mailto:[email protected]]

Could you please post the exact source code of your test
program and the steps you take to (a) build the SDK and (b)
build your test executable? Is your running image a pretty
standard one (core-image-minimal, rpi-test-image or so) or do
your own with custom features?

It did have some custom features, so I did a plain build of
core-image-minimal using raspberrypi3 as the MACHINE. I also did a
populate_sdk for it, and installed the SDK in /opt/poky/2.2.1-a32 by
running the install script.

The test program test.c is just "int main(void) { return 0; }". I
normally use Eclipse CDT to compile native programs, so I set up a
cross project using the SDK, which involves a few manual settings,
including telling it the tools are in
/opt/poky/2.2.1-a32/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux,
and adding a --sysroot to the command lines. The compiler command
line came out as:

arm-poky-linux-gcc
--sysroot=/opt/poky/2.2.1-a32/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi
-O3 -Wall -c -mfloat-abi=hard -MMD -MP -MF"test.d" -MT"test.o" -o
"test.o" "../test.c"

(without the line breaks). I had to add "-mfloat-abi-hard" to get it
to link. The link command line was:

arm-poky-linux-gcc
--sysroot=/opt/poky/2.2.1-a32/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi
-s -o "test" ./test.o

(again, without the line breaks). After dd-ing the image to my SD
card, I mounted it and manually copied the "test" program into its
rootfs. When I stuck it in the RPi3 and ran it, I got

    -sh: ./test: not found

The shell in this case is busybox, so the error message is slightly
different from bash.

I rechecked everything I had described before, analyzing the
executable and comparing it to some working executable from the
rootfs. There must be SOMETHING in my executable that the loader is
barfing on, after it's successfully opened the file but before it
starts looking for libraries. But it's an awfully small executable, so
it's hard to imaging where that something is hiding.

--

Ciao,               Paul D. DeRocco
Paul                mailto:[email protected]
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to