[cfe-dev] Cross compiling with clang (and sysroot support)
Stephen Kelly
steveire at gmail.com
Wed Apr 24 06:57:57 PDT 2013
Hi there,
I'm investigating adding sysroot functionality to cmake
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/6613/focus=6702
Does anyone know what version of clang the --sysroot flag was introduced or
if it was 'a really long time ago'?
I tried to figure out how to cross compile something with clang.
http://clang.llvm.org/UniversalDriver.html
says that clang is inherently a cross compiler, so I guess that means I
don't need a separate binary, as I do with g++ based cross compilers?
I tried using clang with the arguments in this page:
http://wiki.osdev.org/LLVM_Cross-Compiler
without success:
stephen at hal:~/tmp$ cat main.c
int main(int argc, char **argv)
{
return 0;
}
stephen at hal:~/tmp$ clang -target armv7--eabi -mcpu=cortex-a9 main.c
gcc: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
/tmp/main-EitGh6.s: Assembler messages:
/tmp/main-EitGh6.s:1: Error: unknown pseudo-op: `.syntax'
/tmp/main-EitGh6.s:2: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:3: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:4: Error: unknown pseudo-op: `.fpu'
/tmp/main-EitGh6.s:5: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:6: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:7: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:8: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:9: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:10: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:11: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/main-EitGh6.s:18: Error: too many memory references for `sub'
/tmp/main-EitGh6.s:19: Error: expecting operand after ','; got nothing
/tmp/main-EitGh6.s:20: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/main-EitGh6.s:21: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/main-EitGh6.s:22: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/main-EitGh6.s:23: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/main-EitGh6.s:24: Error: too many memory references for `mov'
/tmp/main-EitGh6.s:25: Error: invalid char '[' beginning operand 2 `[sp]'
/tmp/main-EitGh6.s:26: Error: too many memory references for `add'
/tmp/main-EitGh6.s:27: Error: no such instruction: `bx lr'
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to
see invocation)
stephen at hal:~/tmp$ clang --version
Ubuntu clang version 3.2-1~exp5ubuntu2 (tags/RELEASE_32/final) (based on
LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
Am I missing something?
Thanks,
Steve.
More information about the cfe-dev
mailing list