[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?

Sid Manning sidneym at codeaurora.org
Wed Jun 27 06:45:23 PDT 2012


On 06/27/12 07:24, Journeyer J. Joh wrote:
> Hello,
>
> With your kind concern and help, I now can make a binary for ARM target.
>
> ./clang -v --save-temps -ccc-host-triple arm-none-linux-gnueabi
> --sysroot=/home/hum/Documents/Projects/arm_toolchain/arm-2010.09/arm-none-linux-gnueabi/libc
> -gcc-toolchain /home/hum/Documents/Projects/arm_toolchain/arm-2010.09
> hello.c -o hello
>
> The build command is shown above.
>
> After that, I prepared an ARM laptop, AC100 - TOSHIBA.
> I installed Ubuntu 12.04 in the way guided from the link below.
>
> https://wiki.ubuntu.com/ARM/TEGRA/AC100
>
> So I moved the final binary from host PC to AC100 and executed.
> But the binary DIDN'T RUN.
>
> $./hello
>
> returns an error message below.
>
> bash: ./hello: No such file hello
>

You could try readelf -l hello and check the INTERP header.  When I've 
seen this message usually PT_INTERP points to something that the kernel 
can't find.


> I need to understand why it doesn't run on ARM laptop.
>
> I compiled another sample program hi.c on the ARM laptop and compared
> both - the one cross compiled "hello" and the other self host compiled "hi".
>
> Output message of utility "file" is almost the same except Linux
> version, one is 2.6.16 and the other is 2.6.31. But the output of "ldd"
> shows something meaningful.

This is curious based on the output from ldd below, does file report 
each as, "dynamically linked".

>
> ldd hi
>      libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ecf000)
>      /lib/ld-linux-armhf.so.3 (0xb6fc3000)
>
> ldd hello
>      not a dynamic executable
>
>



More information about the llvm-dev mailing list