Hi,
 
Thank you, that made me think about what was installed on my sysroot, which was part of the problem (some dev packages had to be added). I added some packages to the sysroot and got the build further along, but for some reason there is still a failure to find pthread.h from standard include locations. Even though all of the pthread dev is installed on both host and sysroot,making pthread.h available in both "/usr/include" of the host and "sysroot/usr/include" of the sysroot, I keep getting missing headers. The "--includedir=" has no effect.
 
One sample configure I'm trying, where "/mnt" is a loopback mounted clone of the aarch64 system:
${SRC}/configure --prefix=/usr/local/aarch64-linux-gnu/gcc-linaro-6.1-2016.07 --target=aarch64-linux-gnu \
 --with-build-sysroot=/mnt \
 --enable-languages=c,c++ \
 --includedir=/mnt/usr/include
 
Much earlier in the build with this configuration, long before the build halts, I see this:
cc1: error: no include path in which to search for stdc-predef.h
...I have to wonder why this is even though the compile does not halt (with sysroot it doesn't halt here, but it seems sysroot didn't actually provide its version of stdc-predef.h).
 
The build actually terminates with several missing pthread.h messages, e.g.:
In file included from /home/build/linaro/gcc-linaro-snapshot-6.1-2016.07/libgcc/gthr.h:148:0,
                 from /home/build/linaro/gcc-linaro-snapshot-6.1-2016.07/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
 #include <pthread.h>
                     ^
compilation terminated.
Makefile:883: recipe for target '_gcov_dump.o' failed
make[2]: *** [_gcov_dump.o] Error 1

 
Various experiments with "--includedir" options (sysroot/usr/include, sysroot/) in configure failed to change anything. What am I missing? Is this a configure option I need to change? Is this sysroot missing something?
 
Thanks!
 
----- Original Message -----
From: Jim Wilson <jim.wilson@linaro.org>
To: stimits@comcast.net
Cc: Linaro Toolchain Mailman List <linaro-toolchain@lists.linaro.org>
Sent: Sat, 13 Aug 2016 23:16:29 -0000 (UTC)
Subject: Re: stdc-predef.h failed during gcc-linaro-snapshot-6.1-2016.07 compile
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