[cfe-users] C/C++ system include dirs when cross-compiling

Arnaud Allard de Grandmaison via cfe-users cfe-users at lists.llvm.org
Thu Mar 24 13:21:07 PDT 2016


There must be some misunderstanding there.

The goal is to write:

> clang++ -target sparc--netbsd -mcpu=... compile_flags --sysroot=...
--toolchain=.. -o program.exe program.cpp

And clang will cross-compile program.cpp for this specific sparc cpu using
the includes from the sysroot, and link using the linker and libraries from
sysroot+toolchain.
I do no think there is any reason to try to use "g++-arm-linux-gnueabi"
with sysroot, and the fact that the g++ you refer to does not work with
--sysroot is something not relevant to this clang user mailing list --- but
I may be missing something. For your specific problem, you may want to give
a try to the gcc packaged by linaro (http://www.linaro.org/downloads/)
which works pretty well in my experience.

Kind regards,
Arnaud


On Thu, Mar 24, 2016 at 8:29 PM, Jeffrey Walton <noloader at gmail.com> wrote:

> On Thu, Mar 24, 2016 at 11:48 AM, Arnaud Allard de Grandmaison via
> cfe-users <cfe-users at lists.llvm.org> wrote:
> > Hi Patrick,
> >
> > This is a common case when cross compiling, so clang knows how to use a
> > gcc-toolchain installation: you just have to pass it the "--sysroot=..."
> and
> > "--toolchain=..." arguments, and it will get the header files and linker
> /
> > assembler for your target --- assuming your gcc-toolchain has a standard
> > layout.
>
> That last caveat is the one that gives me the most trouble on Ubuntu.
> They seem to have an odd layout for their ARM-HF toolchain, and using
> --sysroot fails to compile/link. Also see "g++-arm-linux-gnueabi
> cannot compile a C++ program with --sysroot",
>
> http://bugs.launchpad.net/ubuntu/+source/gcc-defaults-armel-cross/+bug/1375071
> .
>
> Jeff
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160324/9c6fdd8b/attachment.html>


More information about the cfe-users mailing list