Building a working dc toolchain
Hello,
I'm trying to get a working dreamcast toolchain in ubuntu, but I've had little success.
Currently I'm attempting to use:
binutils-2.20.1
gcc-4.4.5.tar.bz2 (the gcc-4.4.4 patch included with KOS applies cleanly, and I've also tried gcc-4.4.4 repeatedly as well with no changes)
newlib-1.18.0
I've tried using kos/utils/dc-chain/Makefile to get things going. The makefile won't give me libgcc, so some arm/sound related portion of kos fails because it can't find libgcc.
I've reversed engineered the makefile a bit and created my own lame script (hey it's a work in progress) for compiling the toolchain, adding support for building and installing libgcc. KOS will now compile, however, all the examples fail with symbol errors:
/dreamcast/kos/lib/dreamcast/libkallisti.a(init.o): In function `arch_shutdown':
/dreamcast/kos/kernel/arch/dreamcast/kernel/init.c:244: undefined reference to `_fini'
/dreamcast/kos/lib/dreamcast/libkallisti.a(init.o): In function `arch_main':
/dreamcast/kos/kernel/arch/dreamcast/kernel/init.c:196: undefined reference to `_init'
collect2: ld returned 1 exit status
make: *** [2ndmix.elf] Error 1
Can anyone tell me what's causing these symbol errors?
Here's how I'm building everything:
Binutils sh:
../binutils-2.20.1/configure --target=sh-elf --prefix=/dreamcast/dc/sh-elf
make -j#
make install
Binutils arm:
../binutils-2.20.1/configure --target=arm-elf --prefix=/dreamcast/dc/arm-elf
make -j#
make install
gcc bootstrap:
../gcc-4.4.5/configure --target=sh-elf --prefix=/dreamcast/dc/sh-elf --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls --disable-nls --with-multilib-list=m4-single-only,m4-nofpu,m4 --with-endian=little --with-cpu=m4-single-only
make -j# all-gcc all-target-libgcc
make install-gcc install-target-libgcc
newlib:
../newlib-1.18.0/configure --target=sh-elf --prefix=/dreamcast/dc/sh-elf
make all install CC_FOR_TARGET=/dreamcast/dc/sh-elf/bin/sh-elf-gcc AS_FOR_TARGET=/dreamcast/dc/sh-elf/bin/sh-elf-as LD_FOR_TARGET=/dreamcast/dc/sh-elf/bin/sh-elf-ld AR_FOR_TARGET=/dreamcast/dc/sh-elf/bin/sh-elf-ar RANLIB_FOR_TARGET=/dreamcast/dc/sh-elf/bin/sh-elf-ranlib
newlib includes fixup:
cp /dreamcast/kos/include/pthread.h /dreamcast/dc/sh-elf/include/
cp /dreamcast/dc/kos/include/sys/_pthread.h /dreamcast/dc/sh-elf/include/sys/
cp /dreamcast/dc/kos/include/sys/sched.h /dreamcast/dc/sh-elf/include/sys/
ln -nsf /dreamcast/dc/kos/include/kos /dreamcast/dc/sh-elf/include/
ln -nsf /dreamcast/dc/kos/kernel/arch/dreamcast/include/arch /dreamcast/dc/sh-elf/include/
ln -nsf /dreamcast/dc/kos/kernel/arch/dreamcast/include/dc /dreamcast/dc/sh-elf/include/
gcc final sh:
../gcc-4.4.5/configure --target=sh-elf --prefix=/dreamcast/dc/sh-elf --without-headers --with-newlib --enable-languages=c,c++ --disable-libssp --disable-tls --disable-nls --with-multilib-list=m4-single-only,m4-nofpu,m4 --with-endian=little --with-cpu=m4-single-only
make -j# all-gcc all-target-libgcc
make install-gcc install-target-libgcc
gcc final arm:
../gcc-4.4.5/configure --target=arm-elf --prefix=/dreamcast/dc/arm-elf --without-headers --without-headers --with-newlib --enable-languages=c --with-arch=armv4 --disable-libssp --disable-tls --disable-nls
make -j# all-gcc all-target-libgcc
make install-gcc install-target-libgcc
Note: KOS is able to compile this way.