Hi, ludo@xxxxxxx (Ludovic Courtès) writes: > Thus, when building GCC, `-B' and `-isystem' flags must be passed so > that it finds the libc headers, as well as a `-Wl,-dynamic-linker' flag > to pass the path to the dynamic linker. However, none of the > environment variables supposedly honored by `configure' seem to suffice > to propagate these flags through all the GCC build tree and all the > build stages (currently, NixOS GCC builds circumvent this problems by > hacking around Makefiles). > > What's the recommended way to achieve this? FWIW, I solved it by passing various environment variables, either at `configure' time, at `make' time, or both. Namely: 1. I passed `CFLAGS_FOR_BUILD' and `LDFLAGS_FOR_BUILD' with the relevant `-B', `-isystem' and `-Wl,-dynamic-linker' flags to the top-level `configure'. 2. I then ran `make' with make BOOT_LDFLAGS="-B/path/to/libc/lib \ -Wl,-dynamic-linker=/path/to/libc/lib/ld-linux.so.2" \ C_INCLUDE_PATH="$PWD/prev-gcc/include:$PWD/prev-gcc/include-fixed:/path/to/libc/include" \ CPPFLAGS="-DSSIZE_MAX=LONG_MAX" Not all parts of the build require these flags, but it doesn't hurt to pass them from the beginning. The `CPPFLAGS' setting works around the fact that GCC ended up using its own <limits.h> (under `prev-gcc/include-fixed'), which doesn't define `SSIZE_MAX'. This is somewhat kludgey and inconvenient, maybe redundant, but I couldn't find any better way. One complication is that some environment variables are captured and substituted by `config.status', while others are only read by makefiles (and sometimes then captured by a sub-`configure'), making step (2) above unavoidable. Thanks, Ludovic.