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

2016-03-24 Thread Arnaud Allard de Grandmaison via cfe-users
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,
Arnaud

On Thu, Mar 24, 2016 at 4:22 PM, Patrick Boettcher via cfe-users <
cfe-users@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
>  - 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@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


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

2016-03-24 Thread Arnaud Allard de Grandmaison via cfe-users
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  wrote:

> On Thu, Mar 24, 2016 at 11:48 AM, Arnaud Allard de Grandmaison via
> cfe-users  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
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users