gcc-6 has bumped the bundled obstack to gnulib. The bootstrap script now fails with /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: In function 'call_chunkfun': /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:92:23: error: request for member 'extra' in something not a structure or union /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:94:23: error: request for member 'plain' in something not a structure or union /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: In function 'call_freefun': /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:101:15: error: request for member 'extra' in something not a structure or union /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:103:15: error: request for member 'plain' in something not a structure or union /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: At top level: /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:115:24: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:115:46: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:157:17: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:157:39: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:169:19: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:169:41: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:188:39: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:297:1: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: In function '_obstack_memory_used': /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:301:3: error: unknown type name '_OBSTACK_SIZE_T' /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: At top level: /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:89:1: warning: 'call_chunkfun' defined but not used [-Wunused-function] /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c: In function 'call_chunkfun': /home/heroxbd/gentoo/var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libiberty/obstack.c:95:1: warning: control reaches end of non-void function [-Wreturn-type] Reproducible: Always
Because of `export CPPFLAGS="-I${ROOT}/usr/include"` in stage3, obstack.h from glibc took precedence, which is incompatible with obstack.c bundled with gcc-6.
'-isystem' is better here than '-I', it is searched after all directories specified by -I but before the standard system directories.
It turns out that we can get rid of CPPFLAGS in stage3 for RAP. https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f3fc09d56d74aaaeca25fd0691fc2c740f6d0d8a
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=345944686caf4b029c869767ca40d38bee556c61 commit 345944686caf4b029c869767ca40d38bee556c61 Author: Benda Xu <heroxbd@gentoo.org> AuthorDate: 2017-11-29 09:27:03 +0000 Commit: Benda Xu <heroxbd@gentoo.org> CommitDate: 2017-11-29 09:45:43 +0000 bootstrap-prefix.sh: fix CPPFLAGS for header directory in stage3. The CPPFLAGS is needed in stage3 before a working toolchain is built. stage2 headers are not enough when e.g. the host headers are too old. '-isystem' is the correct choice because EPREFIX/usr/include is a system-header-like directory. In rare cases, '-I' causes conflicts between bundled header and system header, like Bug 618488. After the stage3 toolchain is built, directories specified by CPPFLAGS and LDFLAGS are automatically handled and the variables should be removed. Not removing them pollutes the build system of some sophisticated packages which hack CPPFLAGS or LD_LIBRARY_PATH, e.g. dev-libs/gmp-6. Closes: https://bugs.gentoo.org/618488 scripts/bootstrap-prefix.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)