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

Patrick Boettcher via cfe-users cfe-users at lists.llvm.org
Thu Mar 24 15:08:40 PDT 2016


Hi Arnaud,

On Thu, 24 Mar 2016 16:48:30 +0100
Arnaud Allard de Grandmaison <arnaud.adegm at gmail.com> 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.

It wasn't that straight-forward for me to find information
about this "common case" as you call it ;-) .

I initially had problems finding the -B option of clang (it is
not listed in --help nor in --help-hidden).

The --gcc-toolchain-argument does not work with the clang I built:

../../upstream/build/bin/clang++ --gcc-toolchain
clang-3.8: error: unsupported option '--gcc-toolchain'
clang-3.8: error: no input files

But it is listed in --help.

Is this a bug or is my build faulty?


I tried --sysroot and it made the path appear in the
clang-system-include-paths. But my gcc-toolchain does not have the
c++-headers in there just the C ones. 

C++ header files were installed to 

  path/to/toolchain/<tuple>/include/c++/<gcc-version>

I generated my gcc-toolchain with crosstool-ng. I haven't found yet the
option (if any) to tell ct-ng to install c++-headers in sysroot as well.

Thank you for your input.

regards,
--
Patrick.



More information about the cfe-users mailing list