Re: [cfe-users] C/C++ system include dirs when cross-compiling
Hi, On Thu, 24 Mar 2016 16:48:30 +0100 Arnaud Allard de Grandmaison 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. I'm getting back to you after (some vacations and) having compared linaro's latest toolchain to the one I built. Linaro provides a sysroot-package which does not contain c++-header-files. Instead they are located in the gcc-package, as in my package, in /include/c++// I'm unable to convince clang(++) to include this search-dir using any combination of the following options with variations on the path name. --gcc-toolchain= -B --sysroot= sysroot works a little bit, but only for c-include which are located in /usr/include. Using gcc-linaro-5.3-2016.02-x86_64_aarch64-elf I would highly appreciate an example of how to invoke clang++ for cross-compilation with this gcc and its includes? My current try is: TARGET=aarch64-elf \ GCC_ROOT=~/Downloads/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf \ ~/devel/upstream/build/bin/clang++ \ -v \ --target=$TARGET \ --gcc-toolchain=$GCC_ROOT/$TARGET \ --sysroot=$GCC_ROOT/$TARGET/sysroot \ -nostdlib \ -o testCCompiler.cpp.obj -c \ -std=c++11 \ test.cpp test.cpp is empty except #include which it doesn't find. Linaro's gcc has all include paths in its search list. Thanks in advance for any help, -- Patrick. ___ 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
On Thu, Mar 31, 2016 at 11:50 AM, Patrick Boettcher via cfe-users wrote: > Hi, > > On Thu, 24 Mar 2016 16:48:30 +0100 > Arnaud Allard de Grandmaison 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. > > I'm getting back to you after (some vacations and) having compared > linaro's latest toolchain to the one I built. > > Linaro provides a sysroot-package which does not contain > c++-header-files. Instead they are located in the gcc-package, as in > my package, in > > /include/c++// > > I'm unable to convince clang(++) to include this search-dir using any > combination of the following options with variations on the path name. > > --gcc-toolchain= > -B > --sysroot= > > sysroot works a little bit, but only for c-include which are located in > /usr/include. > > Using gcc-linaro-5.3-2016.02-x86_64_aarch64-elf I would highly > appreciate an example of how to invoke clang++ for cross-compilation > with this gcc and its includes? > > My current try is: > > TARGET=aarch64-elf \ > GCC_ROOT=~/Downloads/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf \ > ~/devel/upstream/build/bin/clang++ \ > -v \ > --target=$TARGET \ > --gcc-toolchain=$GCC_ROOT/$TARGET \ > --sysroot=$GCC_ROOT/$TARGET/sysroot \ > -nostdlib \ > -o testCCompiler.cpp.obj -c \ > -std=c++11 \ > test.cpp > > test.cpp is empty except #include which it doesn't find. > > Linaro's gcc has all include paths in its search list. > > Thanks in advance for any help, We found Ubuntu (perhaps Debian) broke the cross-compile using --sysroot some time ago. Also see "g++-arm-linux-gnueabi cannot compile a C++ program with --sysroot", https://bugs.launchpad.net/ubuntu/+source/gcc-defaults-armel-cross/+bug/1375071. We were working around the broken C++ header includes by specifically calling them out with -I. See the comment "Fix C++ header paths for Ubuntu" at https://github.com/weidai11/cryptopp/blob/master/setenv-embedded.sh#L96. ARM's "GCC ARM Embedded Tools" works as expected. Its maintained by ARM employees. Also see the PPA at https://launchpad.net/gcc-arm-embedded. Since the time of the Launchpad bug report, the linker no longer works, either. Jeff ___ 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
On Thu, 31 Mar 2016 12:18:41 -0400 Jeffrey Walton wrote: > > TARGET=aarch64-elf \ > > GCC_ROOT=~/Downloads/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf \ > > ~/devel/upstream/build/bin/clang++ \ > > -v \ > > --target=$TARGET \ > > --gcc-toolchain=$GCC_ROOT/$TARGET \ > > --sysroot=$GCC_ROOT/$TARGET/sysroot \ > > -nostdlib \ > > -o testCCompiler.cpp.obj -c \ > > -std=c++11 \ > > test.cpp > > > > test.cpp is empty except #include which it doesn't find. > > > > Linaro's gcc has all include paths in its search list. > > > > Thanks in advance for any help, > > We found Ubuntu (perhaps Debian) broke the cross-compile using > --sysroot some time ago. Also see "g++-arm-linux-gnueabi cannot > compile a C++ program with --sysroot", > https://bugs.launchpad.net/ubuntu/+source/gcc-defaults-armel-cross/+bug/1375071. I forgot to mention that I'm using llvm/clang 3.8 which I built myself. > We were working around the broken C++ header includes by specifically > calling them out with -I. See the comment "Fix C++ header paths for > Ubuntu" at > https://github.com/weidai11/cryptopp/blob/master/setenv-embedded.sh#L96. That's what I did as well to work around. > ARM's "GCC ARM Embedded Tools" works as expected. Its maintained by > ARM employees. Also see the PPA at > https://launchpad.net/gcc-arm-embedded. Yeah, but is the problem clang not looking into the right paths or gcc-toolchains having changed their layouts. Comparing older gcc-toolchains I had in my attic it seems that clang is not looking hard enough. -- Patrick. ___ 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
>> We were working around the broken C++ header includes by specifically >> calling them out with -I. See the comment "Fix C++ header paths for >> Ubuntu" at >> https://github.com/weidai11/cryptopp/blob/master/setenv-embedded.sh#L96. > > That's what I did as well to work around. > >> ARM's "GCC ARM Embedded Tools" works as expected. Its maintained by >> ARM employees. Also see the PPA at >> https://launchpad.net/gcc-arm-embedded. > > Yeah, but is the problem clang not looking into the right paths or > gcc-toolchains having changed their layouts. Comparing older > gcc-toolchains I had in my attic it seems that clang is not looking hard > enough. It sounds like a Clang bug. If you can reduce it to a minimal test case, consider filing a bug report. Jeff ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users