You are not logged in.

#1 2010-09-26 12:36:04

Dreamkey
Member
Registered: 2010-08-28
Posts: 39

Erros compiling gcc to build a toolchain

Hello,
I try to build a Dreamcast toolchain. I need firstly to build a toolchain using this script before compiling KallistiOS itself. I successfuly compiled binutils (v2.19, because 2.18 or 2.20.1 gave errors), newlib v1.18 and the first pass of gcc, but not the second pass, which is this part in the makefile:

@echo "+++ Building $(src_dir) to $(build) (pass 2)..."
-mkdir -p $(build)
> $(log)
cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib \
   --enable-threads=$(thread_model) --enable-languages=c,c++ $(to_log)
make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
$(clean_up)

Which gave me in a terminal

+++ Building gcc-4.4.4 to build-gcc-sh-elf-4.4.4 (pass 2)...
mkdir -p build-gcc-sh-elf-4.4.4
> /home/dreamkey/Programmation/Dreamcast/SDK/kos/utils/dc-chain/logs/build-gcc-sh-elf-4.4.4-pass2.log
cd build-gcc-sh-elf-4.4.4;  ../gcc-4.4.4/configure --target=sh-elf --prefix=/home/dreamkey/Programmation/Dreamcast/SDK/sh-elf --with-newlib \
           --enable-threads=posix --enable-languages=c,c++ >> /home/dreamkey/Programmation/Dreamcast/SDK/kos/utils/dc-chain/logs/build-gcc-sh-elf-4.5.1-pass2.log 2>&1

I tried to compile gcc v4.5.0, v4.5.1, v4.4.4 using gcc or gcc-3.4 but I always obtain those errors (from the log file "build-gcc-sh-elf-4.4.4-pass2"):

[...]
/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/xgcc -B/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/bin/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/lib/ -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/include -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/sys-include    -g -O2 -ml -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -mieee -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc  -I. -I. -I../../.././gcc -I../../../../gcc-4.5.1/libgcc -I../../../../gcc-4.5.1/libgcc/. -I../../../../gcc-4.5.1/libgcc/../gcc -I../../../../gcc-4.5.1/libgcc/../include  -DHAVE_CC_TLS  -o _df_to_usi.o -MT _df_to_usi.o -MD -MP -MF _df_to_usi.dep -DFINE_GRAINED_LIBRARIES -DL_df_to_usi -c ../../.././gcc/dp-bit.c 
/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/xgcc -B/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/bin/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/lib/ -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/include -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/sys-include    -g -O2 -ml -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -mieee -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc  -I. -I. -I../../.././gcc -I../../../../gcc-4.5.1/libgcc -I../../../../gcc-4.5.1/libgcc/. -I../../../../gcc-4.5.1/libgcc/../gcc -I../../../../gcc-4.5.1/libgcc/../include  -DHAVE_CC_TLS  -o _usi_to_df.o -MT _usi_to_df.o -MD -MP -MF _usi_to_df.dep -DFINE_GRAINED_LIBRARIES -DL_usi_to_df -c ../../.././gcc/dp-bit.c 
/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/xgcc -B/home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/./gcc/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/bin/ -B/home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/lib/ -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/include -isystem /home/dreamkey/Programmation/Dreamcast/sh-elf/sh-elf/sys-include    -g -O2 -ml -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -mieee -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc  -I. -I. -I../../.././gcc -I../../../../gcc-4.5.1/libgcc -I../../../../gcc-4.5.1/libgcc/. -I../../../../gcc-4.5.1/libgcc/../gcc -I../../../../gcc-4.5.1/libgcc/../include  -DHAVE_CC_TLS  -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF unwind-dw2.dep -fexceptions -c ../../../../gcc-4.5.1/libgcc/../gcc/unwind-dw2.c 
In file included from ../../.././gcc/gthr-default.h:1:0,
                 from ../../../../gcc-4.5.1/libgcc/../gcc/gthr.h:162,
                 from ../../../../gcc-4.5.1/libgcc/../gcc/unwind-dw2.c:37:
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:128:1: error: 'sched_yield' undeclared here (not in a function)
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:128:1: warning : type defaults to 'int' in declaration of '__gthrw_sched_yield'
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:133:21: error: operator '>=' has no left operand
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:151:1: error: 'pthread_mutexattr_settype' undeclared here (not in a function)
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:151:1: warning : type defaults to 'int' in declaration of '__gthrw_pthread_mutexattr_settype'
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h: In function '__gthread_yield':
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:709:32: error: called object '__gthrw_sched_yield' is not a function
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h: Hors de toute fonction :
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:773:21: error: operator '>=' has no left operand
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h: In function '__gthread_recursive_mutex_init_function':
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:807:10: error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:807:10: note: each undeclared identifier is reported only once for each function it appears in
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:806:44: error: called object '__gthrw_pthread_mutexattr_settype' is not a function
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h: Hors de toute fonction :
../../../../gcc-4.5.1/libgcc/../gcc/gthr-posix.h:831:21: error: operator '>=' has no left operand
make[5]: *** [unwind-dw2.o] error 1
make[5]: quittant le répertoire « /home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/sh-elf/ml/libgcc »
make[4]: *** [multi-do] error 1
make[4]: quittant le répertoire « /home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/sh-elf/libgcc »
make[3]: *** [all-multi] error 2
make[3]: quittant le répertoire « /home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1/sh-elf/libgcc »
make[2]: *** [all-target-libgcc] error 2
make[2]: quittant le répertoire « /home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1 »
make[1]: *** [all] error 2
make[1]: quittant le répertoire « /home/dreamkey/Programmation/Dreamcast/kos/utils/dc-chain/build-gcc-sh-elf-4.5.1 »

Here are lines of gthr-posix.h that give me errors:

(128)    __gthrw(sched_yield)

(132)    #ifdef _POSIX_TIMEOUTS
(133)    #if _POSIX_TIMEOUTS >= 0
(134)    __gthrw(pthread_mutex_timedlock)

(151)    __gthrw(pthread_mutexattr_settype)

(706)    static inline int
(707)    __gthread_yield (void)
(708)    {
(709)      return __gthrw_(sched_yield) ();
(710)    }

(807)          if (!__r)
(807)        __r = __gthrw_(pthread_mutexattr_settype) (&__attr,
(807)                               PTHREAD_MUTEX_RECURSIVE);

(830)    #ifdef _POSIX_TIMEOUTS
(830)    #if _POSIX_TIMEOUTS >= 0

For example, I don't understand why "_POSIX_TIMEOUTS" works with the ifdef on line 132 but not on line 133...

Do you know what should I do?
Thanks smile

PS: I running archlinux x86_64, I don't know if it can be the problem.

Offline

#2 2010-10-01 18:19:33

Dreamkey
Member
Registered: 2010-08-28
Posts: 39

Re: Erros compiling gcc to build a toolchain

I just try to compile using Arch 32bits on a virtual machine, but it failed with the same errors. I saw that the Makefile applies few patches, but I didn't think that it's the source of my problems...

Nobody wants to compile on his machine to check that?

Offline

Board footer

Powered by FluxBB