[cfe-dev] Cross compiling with clang (and sysroot support)

Tim Northover t.p.northover at gmail.com
Wed Apr 24 07:20:41 PDT 2013

Hi Stephen,

I'm afraid I'm not sure when Clang started accepting sysroot; someone
else will probably have to answer that.

> 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'

This is because Clang has decided to call (probably) the host's
assembler, /usr/bin/as, to assemble the ARM code it just produced.
That's obviously not going to work very well if your host is x86.

It would actually use the --sysroot option (amongst other things) to
try and find appropriate headers/assembler/linker/... if it was
present. Whether it could actually find them or not is another matter,
of course. The code is rather heuristic.


More information about the cfe-dev mailing list