[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 08:48:30 PDT 2016

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.

Kind regards,

On Thu, Mar 24, 2016 at 4:22 PM, Patrick Boettcher via cfe-users <
cfe-users at lists.llvm.org> wrote:

> Hi list,
> I'm using clang to cross-compile for a sparc-target.
> Except for the compiler I (seem to) rely entirely on gcc-tools (ld,
> asm). I doing this by passing the -B
> <path-to-gcc-toolchain> - flag to clang.
> I'm now facing an issue where I would like to have clang use the
> c++-system-includes of my gcc-installation.
> When I dump the considered include-dirs with
>   echo | sparc-elf-gcc -nostdlib -xc++ -E -Wp,-v - -fsyntax-only
> I'm getting a list of all the paths I'm looking for. Doing the same
> with clang (even with the -B-flag) having the -target-flag set, the
> list is empty.
> What is the proper way to let clang now where to find the
> system-includes in cross-compilation scenarios?
> I'm now using a script which generates -isystem-arguments which based
> on a list generated with a call as shown above.
> Should the list be derived from the -B-argument?
> best regards,
> --
> Patrick.
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160324/7df63164/attachment.html>

More information about the cfe-users mailing list