llvm-gcc fails to build libgcc when built with itself

Hello,

I’m trying the following thing:
• build and install llvm with mgcc (system compiler)
• build and install llvm-gcc with mgcc
• build llvm with llvm-gcc
• deinstall llvm(old), install llvm(new)
• build llvm-gcc with llvm-gcc(old)
• deinstall llvm-gcc(old), install llvm-gcc(new)

However, I have the problem that the llvm-gcc(new) does not work: after
it is compiled, it tries to build libgcc2 with itself (llvm-gcc(new)),
which fails on a few files:

/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2/host-i386-ecce-mirbsd10/gcc/xgcc -B/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2/host-i386-ecce-mirbsd10/gcc/ -B/usr/mpkg/i386-ecce-mirbsd10/bin/ -B/usr/mpkg/i386-ecce-mirbsd10/lib/ -isystem /usr/mpkg/i386-ecce-mirbsd10/include -isystem /usr/mpkg/i386-ecce-mirbsd10/sys-include -O2 -O2 -O2 -pipe -std=gnu99 -O1 -Wformat -fwrapv -fno-strict-aliasing -march=i486 -mtune=pentium-mmx -mpreferred-stack-boundary=2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -pthread -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -I../.././gcc/../libdecnumber -I../libdecnumber -I/usr/mpkg/include -I/usr/mpkg/include -DL_powisf2 -c ../.././gcc/libgcc2.c -o libgcc/./_powisf2.o

This command seems to hang spinning or something:

  PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND
16398 tg 64 0 10M 6948K run - 14:36 93.60% cc1

Appending “-emit-llvm” to the compile command does not help.

Preprocessed output (-E -dD) is attached.

bye,
//mirabilos

_powisf2.i.gz (35.8 KB)

Dixi quod…

• build llvm with llvm-gcc
• deinstall llvm(old), install llvm(new)

At this point, the clang(new) built is working just fine though.

• build llvm-gcc with llvm-gcc(old)

[…]

16398 tg 64 0 10M 6948K run - 14:36 93.60% cc1

Aborted after more than 32 CPU minutes on Pentium-M 1.4 GHz.

bye,
//mirabilos

Can you bootstrap llvm-gcc (configure with --enable-bootstrap)?

Ciao,

Duncan.

Duncan Sands dixit:

Can you bootstrap llvm-gcc (configure with --enable-bootstrap)?

Nope, probably because it uses the host C++ compiler instead of the
one built in stage1 during stage2:

/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2/host-i386-ecce-mirbsd10/prev-gcc/xgcc -B/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2/host-i386-ecce-mirbsd10/prev-gcc/ -B/usr/mpkg/i386-ecce-mirbsd10/bin/ -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -DHAVE_CONFIG_H -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -I../.././gcc/../libdecnumber -I../libdecnumber -I/usr/mpkg/include -I/usr/mpkg/include -DENABLE_LLVM -I/usr/mpkg/include -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_VERSION_INFO='"SVN r58935-MirPorts-1"' ../.././gcc/dummy-checksum.c -o dummy-checksum.o
c++ -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wno-variadic-macros -Wmissing-format-attribute -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"i386-ecce-mirbsd10\" -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -I../.././gcc/../libdecnumber -I../libdecnumber -I/usr/mpkg/include -I/usr/mpkg/include -DENABLE_LLVM -I/usr/mpkg/include -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_VERSION_INFO='"SVN r58935-MirPorts-1"' -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include -I../.././gcc/../libdecnumber -I../libdecnumber -I/usr/mpkg/include -I/usr/mpkg/include ../.././gcc/llvm-main.cpp -o llvm-main.o
cc1plus: error: unrecognized command line option "-Wno-variadic-macros"
gmake[3]: *** [llvm-main.o] Error 1
gmake[3]: Leaving directory `/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2/host-i386-ecce-mirbsd10/gcc'
gmake[2]: *** [all-stage2-gcc] Error 2
gmake[2]: Leaving directory `/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2'
gmake[1]: *** [stage2-bubble] Error 2
gmake[1]: Leaving directory `/usr/ports/lang/llvm-gcc/w-llvm-gcc4.2-58935-1/llvm-gcc4.2'
gmake: *** [all] Error 2
*** Error code 2

Stop in /usr/ports/lang/llvm-gcc (line 2263 of /usr/ports/infrastructure/mk/bsd.port.mk).

bye,
//mirabilos

>Can you bootstrap llvm-gcc (configure with --enable-bootstrap)?

Nope, probably because it uses the host C++ compiler instead of the
one built in stage1 during stage2:

This is, unfortunately, an old problem (there's a bug report about
it somewhere). What is the system C++?

Ciao,

Duncan.