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

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

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,

More information about the cfe-users mailing list