[cfe-dev] Cross compiling with clang (and sysroot support)
t.p.northover at gmail.com
Wed Apr 24 08:17:15 PDT 2013
> /usr/bin/arm-linux-gnueabi-gcc-4.7 main.c
> 'Just Works'. /usr/bin/arm-linux-gnueabi-as also exists.
In that case, I'd suggest using "-target arm-linux-gnueabi" as a
starting-point. Clang does use this target in its search for an
appropriate assembler and linker. I think I concluded that it'll find
it if arm-linux-gnueabi-as is on the path, but I'm not certain.
Other than that, the key point is where the ARM libraries and headers
are. There's a chance Clang will find them by itself with the correct
-target option. If not, the --sysroot option is what you'll have to
use to give it a hint.
> All I need is some way to cross compile something for some platform, so if I
> can invoke clang in a way that it will use that cross-as, that would be
A parallel option would be to add "-integrated-as" as an option. Then
Clang does the assembly step itself. I didn't mention it because you'd
still need the linker to produce a working binary.
More information about the cfe-dev