[LLVMdev] Is cross-compiling for ARM on x86 with llvm/Clang possible?
Journeyer J. Joh
oosaprogrammer at gmail.com
Wed Aug 29 01:13:50 PDT 2012
Hello Tsukishiro
First of all, I am in a learning stage of LLVM and Clang. This means I
am not an expert! ^^;
The final trial I succeeded was under the environment below.
- Target : TOSHIBA AC100 / Ubuntu 12.04 (https://wiki.ubuntu.com/ARM/**
TEGRA/AC100 <https://wiki.ubuntu.com/ARM/TEGRA/AC100>)
- Host : i386 Desktop PC / Ubuntu 12.04
- Toolchain on host : sudo apt-get install gcc-arm-linux-gnueabi
- Clang/llvm compile : http://clang.llvm.org/get_started.html
I wonder your environment.
- Target :
- Host :
- Toolchain on host : How did you get your toolchain?
- Clang/llvm compile : How did you compile Clang/llvm?
I tested successfully with a command below.
- Command string for crossbuild : ./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
Important options are shown below.
-ccc-host-triple : arm-linux-gnueabi
--sysroot : /usr/arm-linux-gnueabi
-gcc-toolchain : /usr/
-Wl,-dynamic-linker,/lib/ld-linux-armhf.so.3
I want to know your command string not mine. Could you write it to me?
I am afraid I could fail to help you.... I am not an expert.. Please
consider this.
Best regards
Journeyer
2012/8/29 tsukishiro <tsukishiro88 at gmail.com>:
> 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.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
--
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l d o t c o m
----------------------------------------
More information about the llvm-dev
mailing list