[cfe-dev] Cross compiling with clang (and sysroot support)
t.p.northover at gmail.com
Wed Apr 24 09:10:57 PDT 2013
> which looks appropriate. But what should I pass in the --sysroot?
Unfortunately, it looks like this is odd enough that Clang won't
detect it by itself no matter what sysroot you specify. In particular
it doesn't know anything about "gcc-cross" as a possible location.
Four options come to mind:
+ Fix clang so that it does try to look in gcc-cross.
+ Mess around with your filesystem so that it resembles what Clang is
searching for (e.g. symlink /usr/lib/gcc-cross/arm-linux-gnueabi to
/usr/lib/gcc/arm-linux-gnueabi; other things may be needed too but
there's not enough information to say yet).
+ Use Clang for the compile step ("clang -target ... -c") and gcc for
the link step ("arm-linux-gnueabi-gcc main.o -omain"). This is still
dodgy w.r.t. headers, if clang is trying to use the ones from
/usr/include, but has a good chance of working anyway.
+ Pass these special options and files yourself on the Clang command-line.
More information about the cfe-dev