Fixes glibc stage 2 pthread errors (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 15 Jan 2015 18:03:13 +0000 (10:03 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 15 Jan 2015 18:03:13 +0000 (10:03 -0800)
On many, but not all, Akaros installations, the toolchain build would fail in
stage 2 of glibc, during the nss build.

The failure was due to the make system clobbering Parlib's pthread.h with the
one from glibc-2.19/include/pthread.h.  Not all systems would do the install,
which is rather mystifying.  It looks like the build system would see pthread.h
was needed, and then generate dependencies on both ../include/pthread.h and on
$TOOLCHAIN_SYSROOT/usr/include/pthread.h (the latter is Akaros's).  Some
systems would install include/pthread.h into the toolchain sysroot.  Others
would not.

By removing include/pthread.h, the dependency on that file was never created,
and thus never attempted to be installed.

Old dependency info:
$ grep -r pthread.h x86_64-ucb-akaros-glibc-stage2-builddir/
...
x86_64-ucb-akaros-glibc-stage2-builddir/nss/db-init.os.d: ../nscd/nscd.h ../include/pthread.h \
x86_64-ucb-akaros-glibc-stage2-builddir/nss/db-init.os.d: $TOOLCHAIN_INSTALL/x86_64-ucb-akaros/sysroot/usr/include/pthread.h
...

Old dependency info:
$ grep -r pthread.h x86_64-ucb-akaros-glibc-stage2-builddir/
...
x86_64-ucb-akaros-glibc-stage2-builddir/nss/db-init.os.d: $TOOLCHAIN_INSTALL/x86_64-ucb-akaros/sysroot/usr/include/pthread.h
...

You'll need to make clean your toolchain and rebuild.

tools/compilers/gcc-glibc/Makefile

index 77a42d9..40d0983 100644 (file)
@@ -462,9 +462,12 @@ $(BINARY_PREFIX)gcc-stage2-builddir: gcc-$(GCC_VERSION)
             | grep -v "Only in ../glibc-$(GLIBC_VERSION)" \
             | patch -p2 
 
+# On occasion, include/pthread.h was getting installed in stage 2, clobbering
+# parlib's pthread.h.
 glibc-$(GLIBC_VERSION): glibc-$(GLIBC_VERSION).tar.bz2
        rm -rf glibc-$(GLIBC_VERSION)
        tar -jxf glibc-$(GLIBC_VERSION).tar.bz2
+       rm glibc-$(GLIBC_VERSION)/include/pthread.h
        $(MAKE) .glibc-akaros-patch
        patch --no-backup-if-mismatch -p0 < glibc-$(GLIBC_VERSION)-riscv.patch