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

tsukishiro tsukishiro88 at gmail.com
Tue Aug 28 22:18:56 PDT 2012


Hi Journeyer

First, thank you so much for your updates on your experiments.
I am currently following your steps but have found myself stuck with the
following error:

/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld:
this linker was not configured to use sysroots
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

I used the command string you wrote :
./clang -v --save-temps -ccc-host-triple arm-linux-gnueabi
--sysroot=/usr/arm-linux-gnueabi -gcc-toolchain /usr/
-Wl,-dynamic-linker,/lib/ld-linux-armhf.so.3 hello.c -o hello

Can you help me identify the problem?
I'm also really interested in cross compiling ARM and x86.

For the complete logs of the above command, please refer below :

clang version 3.1 (branches/release_31)
Target: arm--linux-gnueabi
Thread model: posix
 "/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/clang"
-cc1 -triple armv4t--linux-gnueabi -E -disable-free -main-file-name hello.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft
-target-feature +soft-float-abi -target-linker-version 2.20.1
-momit-leaf-frame-pointer -v -resource-dir
/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/../lib/clang/3.1
-isysroot /usr/arm-linux-gnueabi -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/arm-linux-gnueabi/usr/local/include -internal-isystem
/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/../lib/clang/3.1/include
-internal-externc-isystem /usr/arm-linux-gnueabi/include
-internal-externc-isystem /usr/arm-linux-gnueabi/usr/include
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/jedd10-04/TOOC/clang-samples -ferror-limit 19 -fmessage-length 132
-mstackrealign -fno-signed-char -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option
-fcolor-diagnostics -o hello.i -x c hello.c
clang -cc1 version 3.1 based upon LLVM 3.1 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/local/include"
ignoring nonexistent directory "/usr/arm-linux-gnueabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:

/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/../lib/clang/3.1/include
 /usr/arm-linux-gnueabi/include
End of search list.
 "/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/clang"
-cc1 -triple armv4t--linux-gnueabi -S -disable-free -main-file-name hello.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft
-target-feature +soft-float-abi -target-linker-version 2.20.1
-momit-leaf-frame-pointer -v -resource-dir
/home/jedd10-04/TOOC/LLVM-3.1/llvm-3.1.src/build/Debug+Asserts/bin/../lib/clang/3.1
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/jedd10-04/TOOC/clang-samples -ferror-limit 19 -fmessage-length 132
-mstackrealign -fno-signed-char -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option
-fcolor-diagnostics -o hello.s -x cpp-output hello.i
clang -cc1 version 3.1 based upon LLVM 3.1 default target
x86_64-unknown-linux-gnu
#include "..." search starts here:
End of search list.
 "/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/as"
-o hello.o hello.s
 "/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld"
--sysroot=/usr/arm-linux-gnueabi -z relro -X --hash-style=both --build-id
--eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux.so.3 -o
hello /usr/arm-linux-gnueabi/lib/crt1.o /usr/arm-linux-gnueabi/lib/crti.o
/usr/lib/gcc/arm-linux-gnueabi/4.6/crtbegin.o
-L/usr/lib/gcc/arm-linux-gnueabi/4.6 -L/usr/arm-linux-gnueabi/lib
-dynamic-linker /lib/ld-linux-armhf.so.3 hello.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/arm-linux-gnueabi/4.6/crtend.o
/usr/arm-linux-gnueabi/lib/crtn.o
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld:
this linker was not configured to use sysroots
clang: error: linker command failed with exit code 1 (use -v to see
invocation)



--
View this message in context: http://llvm.1065342.n5.nabble.com/Is-cross-compiling-for-ARM-on-x86-with-llvm-Clang-possible-tp46279p48471.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list