On Sat, Aug 13, 2016 at 3:17 PM, stimits@comcast.net wrote:
I've been trying to build the c and c++ cross-compiler for triplet aarch64-linux-gnu (--target=aarch64-linux-gnu --enable-languages=c,c++) on snapshot for 6.1-2016.07, and cannot get past this: cc1: error: no include path in which to search for stdc-predef.h
stdc-predef.h is a glibc header file that defines macros that the ISO C standard requires that the compiler define by default. So gcc includes the file by default for linux targets, unless you use -ffreestanding or -nostdinc. The real problem here is that you are apparently trying to build a cross compiler without glibc, and that doesn't work. Glibc is required for the compiler build when building for a linux target.
If you have a target OS that already has a userspace filesystem, then you can create a sysroot that contains /lib, /usr/lib, /usr/include (and other library dirs if they exist), put a copy on the machine where you are doing the compiler build, and then use a --sysroot configure option to point at the sysroot. This also requires that binutils is configured with the same --sysroot option. If you don't care about the target OS, you could grab one of the sysroots that the tcwg team builds and releases.
Alternatively, you can build gcc and glibc at the same time. This is complicated, because of the circular dependencies between gcc and glibc, so it is best to use a script. Linaro uses ABE for toolchain builds. https://wiki.linaro.org/ABE But there are other choices, like crosstools-ng and Open Embedded.
I wouldn't recommend modifying gcc sources to work around this, as then you will get a compiler that doesn't fully conform to the ISO C standard.
Jim