C compilers

Getting GCC built is very important for the GNU project. It's written in C++ now but it can be built using earlier versions of GCC that are written in C. (e.g. 4.7)

Can pcc build tcc (mob) [yes]
yes. http://repo.or.cz/tinycc.git

Can pcc build gcc 4.7? [no]
No: ../.././libdecnumber/bid/decimal128.c, line 73: compiler error: classifystruct error: /home/debbie/pcc-boot/libexec/ccom terminated with status 1

Line 73 of ./libdecnumber/bid/decimal128.c:

/* __dpd128FromNumber returns in big endian. But _dpd_to_bid128 takes host endian. */ __ieee_to_host_128 (*d128, &u._Dec);

It would be good to figure out and why and make it work!

Can pcc build gcc 7.1.0 [unclear]
Unclear. Since pcc also has a c++ compiler there is a chance.

CC=pcc CPP=pcpp CXX=p++ CC_FOR_TARGET=pcc CPP_FOR_TARGET=pcpp CXX_FOR_TARGET=p++ ./configure --enable-languages=c,c++ --prefix=$HOME/gcc-out

but I got the error:

checking for uintmax_t... no checking for uintptr_t... no configure: error: uint64_t or int64_t not found Makefile:4277: recipe for target 'configure-stage1-gcc' failed make[2]: *** [configure-stage1-gcc] Error 1

Can pcc build gcc 3.2 [no]
No.

pcc -c -DIN_GCC   -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I. -I/home/debbie/gcc-3.2/gcc -I/home/debbie/gcc-3.2/gcc/. -I/home/debbie/gcc-3.2/gcc/config -I/home/debbie/gcc-3.2/gcc/../include /home/debbie/gcc-3.2/gcc/read-rtl.c -o read-rtl.o /home/debbie/gcc-3.2/gcc/read-rtl.c, line 662: lvalue required /home/debbie/gcc-3.2/gcc/read-rtl.c, line 662: cannot recover from earlier errors: goodbye! error: /home/debbie/pcc-boot/libexec/ccom terminated with status 1 Makefile:2177: recipe for target 'read-rtl.o' failed make[1]: *** [read-rtl.o] Error 1

Can tcc build gcc 4.7.4? [yes]
Yes! Huge thanks to the tinycc mob: http://lists.nongnu.org/archive/html/tinycc-devel/2017-05/msg00099.html

$ sha256sum gcc-4.7.4.tar.gz ddbaa583c5d4e4f0928bf15d9f6b6c283349e16eedc47bde71e1b813f6f37819 gcc-4.7.4.tar.gz

tinycc (mob) commit 53c5fc2246270e0242903de0152a9a5d40f3d679

MAKEINFO=missing CC=tcc $HOME/gcc-4.7.4/configure --prefix=$HOME/gcc-out --enable-languages=c --disable-multilib

it requires a lot of space, multiple gigabytes to build.

Can tcc build pcc [no]
No.

First of all CPP=tcc ./configure gives an error: preprocessor fails sanity check. If we just use the line

CC=tcc ./configure --prefix=$HOME/pcc-tcc-out/

it compiles some of the way then fails with:

tcc -g  -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -Wtruncate -D_BSD_SOURCE -DGCC_COMPAT -DPCC_DEBUG -DNATIVE_FLOATING_POINT -D_ISOC99_SOURCE -Dos_linux -Dmach_amd64 -I. -I. -I../.. -I../../mip -I../../arch/amd64 -I../../os/linux -I../../common -c -o local2.o ../../arch/amd64/local2.c ../../arch/amd64/local2.c:44: error: unknown type size Makefile:148: recipe for target 'local2.o' failed make[2]: *** [local2.o] Error 1

Other

 * Which C compilers can build which (other) C compilers?
 * ACK http://tack.sourceforge.net/
 * Recc http://recc.robertelder.org/
 * Cint (interpreter)?
 * clang
 * SmallerC

Links

 * http://wiki.osdev.org/Building_GCC