Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Dreamcast »

Below is a guide I've put together for configuring and compiling both SH and ARM toolchains as well as the KOS SDK. I will upload a compiled toolchain once this configuration is verified.

MinGW was chosen over Cygwin because of its much smaller installation size. For comparison:

CYGWIN (base only):
~ 760 MB
~ 33,500 files

MINGW (base, packages, kos + kos-ports (compiled), toolchain (sh and arm compiled)):
~ 790 MB
~ 10,500 files

Note 1: Downloading and configuring will take about an hour or less (depending on your experience). Compiling the toolchain and KOS will take a few hours. Before beginning, please ensure you have at least 1.5 - 2GB of free hard drive space.

Note 2: It has been brought to my attention that the MinGW installer may sometimes report that some packages were unable to be downloaded. If this is the case, try reinstalling MinGW before continuing since the missing packages may contain dependencies required to build the toolchain.
Last edited by Dreamcast on Sat Jan 08, 2011 6:56 am, edited 1 time in total.
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Dreamcast »

Revision 01: Added "cygwin1.dll" file to the mingwpack (needed for genromfs.exe).
Revision 02: Symbolic link step added during the KOS compilation part (otherwise it gives a "cc" error).

[KOS MINGW 4.5.2 SETUP GUIDE BY DREAMCAST â„¢ (2010)]

MINGW INSTALLATION / SETUP

1) Download mingw-get-inst: http://sourceforge.net/projects/mingw/ and run it.
  • select "download latest repository catalogues"
  • set install directory to "c:\mingw"
  • check boxes "c compiler", "c++ compiler", "objc compiler" and "msys basic system"
3) Once the download is complete, go to "c:\mingw\msys\1.0\" and create a folder called "kos"
4) From the "mingwpack" archive, place "patch.exe" in "c:\mingw\bin"

INSTALLING KOS (SVN won't be covered in this tutorial, but its usage is recommended.)

1) If you don't have a SVN client, go here (http://cadcdev.svn.sourceforge.net/viewvc/cadcdev/) and download the GNU tarballs in the KOS and KOS-PORTS

directories. Extract each archive to the created "kos" folder so the paths are "kos/kos" and "kos/kos-ports".

2) Place "environ.sh" from the "mingwpack" archive in the "kos/kos" directory (overwrite any existing version).

TOOLCHAIN PREREQUISITES

1) Navigate to kos/kos/utils/dc-chain. Extract "gcc-4.5.2-kos.diff" from the "mingwpack" archive and place it in the "patches" folder. Extract Makefile and

replace the existing file in the dc-chain directory.

2.1) Go here and download these packages and extract them to a new folder called "gcc-4.5.2" created in the "dc-

chain" directory (if using WinRAR, right click on each archive and select "extract files" and set the destination path to "c:\mingw\msys\1.0

\kos\kos\utils\dc-chain"):
  • gcc-core-4.5.2.tar.bz2
  • gcc-objc-4.5.2.tar.bz2
  • gcc-g++-4.5.2.tar.bz2
2.2) Go here and download mpfr-2.4.2.tar.bz2 (3.0.0 currently doesn't work)
2.3) Go here and download mpc-0.8.2.tar.tar
2.4) Go here and download gmp-5.0.1.tar.bz2

2.5) Extract each of the above three archives to the gcc-4.5.2 directory. Rename each folder to only the text before the hypen (ex: mpfr-2.4.2 would just be

"mpfr").

3) Go here and download binutils 2.20.1.tar.bz2. Extract it to the "dc-chain" directory (ensure the created folder

name is "binutils-2.20.1").
4) Go here and download newlib-1.18.0.tar.gz. Extract it to the "dc-chain" directory (ensure the

created folder name is "newlib-1.18.0").

When you're done, the created paths should look like this:
  • /dc-chain/gcc-4.5.2/
  • /dc-chain/gcc-4.5.2/mpfr/
  • /dc-chain/gcc-4.5.2/mpc/
  • /dc-chain/gcc-4.5.2/gmp/
  • /dc-chain/binutils-2.20.1/
  • /dc-chain/newlib-1.18.0/
Ensure the files / folders from the extracted archives are at the top level of each of those subdirectories, and a folder wasn't created within the folder

you were extracting to (ex: /dc-chain/binutils-2.20.1/binutils-2.20.1 should be /dc-chain/binutils-2.20.1).

BUILDING THE TOOLCHAIN

1) In the msys directory (c:/mingw/msys/1.0/), run "msys.bat" to access the bash console. From the console, type:

Code: Select all

cd /usr/kos/kos/utils/dc-chain
The console should now show the dc-chain directory as the current path. Type "make" and press the "enter" key to begin compiling.

BUILDING KOS

(Before starting, place the files in the "vqenc" folder in the "mingwpack" archive into the "/kos/kos/utils/vqenc" directory. Place the "genromfs.exe" and

"cygwin1.dll" files in the genromfs directory.

1) Type "cd ../../" and press the enter key.
2) Type "source environ.sh" and press the enter key.
3) Type "ln -s /mingw/bin/gcc.exe /mingw/bin/cc.exe" and press the enter key.
4) Type "make" and press the enter key.

BUILDING KOS PORTS

1) After KOS is built, type "cd ../kos-ports" and press the enter key.
2) Type "make" and press the enter key.

FINAL STEPS

1) When you're sure everything has compiled correctly, you can delete the directories created earlier in the dc-chain folder.
2) Navigate to the "c:\mingw\msys\1.0\etc" directory and edit the "profiles" file by either opening notepad and dropping the file onto it. At the bottom, add

"cd /usr/kos/kos" and then add "source environ.sh" below that. Save the file. When you start the mingw bash console, you'll now be at the root KOS directory

and have the environment variables configured.


Congratulations. If all went well, you now have a working toolchain and updated build of KOS. Happy deving.
Attachments
mingwpack.zip
(added cygwin1.dll)
(2.14 MiB) Downloaded 602 times
Last edited by Dreamcast on Sat Jan 08, 2011 10:00 am, edited 6 times in total.
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7497
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Quzar »

Yea, the biggest reason that cygwin is preferred (afaik) is because everyone else uses it so it's easier to find people to assist in setup.

Good job on this.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Dreamcast »

Funny you should be the first to reply. I was just trying out your VMUBeep example after discovering the function in the VMU include :D.

The one thing I wish MinGW had is more precompiled packages. I haven't found a suitable SVN for it and subversion won't compile. The other thing is the vqenc and genromfs EXEs in the KOS package. I had to source older versions because they also won't compile (I think genromfs may have compiled in Cygwin, but vqenc hasn't in either). Neither of them have been updated in a long time, so using older versions probably won't matter anyways.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlackAura »

I haven't found a suitable SVN for it and subversion won't compile.
You don't need a MinGW-specific version of Subversion. Any of the normal Windows binaries will do the trick.

http://subversion.apache.org/packages.html#windows

It would be useful if they had some kind of package manager though. At the very least, one of the ports-style ones that downloads and compiles the source code (and all the dependencies) for you. Something like MacPorts / Fink / Homebrew on a Mac, or emerge from Gentoo.

As for genromfs and vqenc... There's no inherent reason they shouldn't compile with MinGW. They certainly used to work quite a long time ago, although I think they might have needed patching. You definitely need the PNG and JPEG libraries for vqenc to compile.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

Genromfs required you to have the MSYS SDK installed, and to make a small change to the source code in order to get it to build under it. I don't remember exactly what it was, because it was quite some time ago (and I'm reasonably sure that the changes/built version that I had disappeared with my old website).

That said, I'll be uploading a new set of patches to KOS' repo to build the toolchain properly with new versions of all the tools (Binutils 2.21, GCC 4.5.2, and Newlib 1.19.0) sometime hopefully later today. These fix all the thread stuff to be properly done (so it supports detaching threads, for instance).
User avatar
Neoblast
DC Developer
DC Developer
Posts: 314
Joined: Sat Dec 01, 2007 8:51 am
Has thanked: 3 times
Been thanked: 1 time

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Neoblast »

Testing it right now, thank you very much dctm.
Looking forward to those patches then.

With all this... it's been a while since r4, will there be a new release soon?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

I've updated the patches in the KOS repository, as I said I would (with 5 minutes to spare in the day). :wink:

I'll update the Makefile for dc-chain so that everything builds as expected tomorrow probably (with the current versions of everything and all). I built all my stuff without the Makefile in dc-chain, so I didn't modify it along the way.
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Dreamcast »

Thanks, Bluecrab :). For anyone wanting to update and use MinGW, hold on until Bluecrab updates the makefile. Once I verify whether or not mpfr 3.0.0 works (so far, only 2.4.2 has, but I hadn't patched 3.0.0 until now), I'll upload an archive of all of the packages so you just have to extract them to the base mingw installation and they'll be put in the right directories.

Vqenc finally compiled, but a change needs to be made to the source. It either needs an include for zlib.h added to readpng.c or just comment out the section that outputs the ZLIB version.

Genromfs uses POSIX-based functions Mingw doesn't support, so for that it's just easier to use the Cygwin built version and use the one Cygwin DLL it requires.

Thanks for the tip on Subversion, Blackaura. It will be much more convenient doing everything from within the console for the tutorial.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

I've updated all of the dc-chain stuff in the KOS repo, so please test it out and make sure everything works all right. I had it build a toolchain, but I haven't actually tested it with anything as of yet (since I built my normal toolchain by hand the other day).

The Makefile seemed to build everything just fine, so I'm assuming it worked properly.
patbier
DC Developer
DC Developer
Posts: 152
Joined: Fri Aug 29, 2003 1:25 am
Has thanked: 0
Been thanked: 0

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by patbier »

Thanks all of you to make the toolchain updated.
I've tested the new makefile but I have an error when it builds the new lib :

I quote the end of build-newlib-sh-elf-1.19.0.log :

Code: Select all

rm -f lib.a
sh-elf-ar cru lib.a lib_a-s_finite.o lib_a-s_copysign.o lib_a-s_modf.o lib_a-s_scalbn.o lib_a-s_cbrt.o lib_a-s_exp10.o lib_a-s_expm1.o lib_a-s_ilogb.o lib_a-s_infconst.o lib_a-s_infinity.o lib_a-s_isinf.o lib_a-s_isinfd.o lib_a-s_isnan.o lib_a-s_isnand.o lib_a-s_log1p.o lib_a-s_nan.o lib_a-s_nextafter.o lib_a-s_pow10.o lib_a-s_rint.o lib_a-s_logb.o lib_a-s_log2.o lib_a-s_matherr.o lib_a-s_lib_ver.o lib_a-s_fdim.o lib_a-s_fma.o lib_a-s_fmax.o lib_a-s_fmin.o lib_a-s_fpclassify.o lib_a-s_lrint.o lib_a-s_llrint.o lib_a-s_lround.o lib_a-s_llround.o lib_a-s_nearbyint.o lib_a-s_remquo.o lib_a-s_round.o lib_a-s_scalbln.o lib_a-s_signbit.o lib_a-s_trunc.o lib_a-sf_finite.o lib_a-sf_copysign.o lib_a-sf_modf.o lib_a-sf_scalbn.o lib_a-sf_cbrt.o lib_a-sf_exp10.o lib_a-sf_expm1.o lib_a-sf_ilogb.o lib_a-sf_infinity.o lib_a-sf_isinf.o lib_a-sf_isinff.o lib_a-sf_isnan.o lib_a-sf_isnanf.o lib_a-sf_log1p.o lib_a-sf_nan.o lib_a-sf_nextafter.o lib_a-sf_pow10.o lib_a-sf_rint.o lib_a-sf_logb.o lib_a-sf_log2.o lib_a-sf_fdim.o lib_a-sf_fma.o lib_a-sf_fmax.o lib_a-sf_fmin.o lib_a-sf_fpclassify.o lib_a-sf_lrint.o lib_a-sf_llrint.o lib_a-sf_lround.o lib_a-sf_llround.o lib_a-sf_nearbyint.o lib_a-sf_remquo.o lib_a-sf_round.o lib_a-sf_scalbln.o lib_a-sf_trunc.o lib_a-atanl.o lib_a-cosl.o lib_a-sinl.o lib_a-tanl.o lib_a-tanhl.o lib_a-frexpl.o lib_a-modfl.o lib_a-ceill.o lib_a-fabsl.o lib_a-floorl.o lib_a-log1pl.o lib_a-expm1l.o lib_a-acosl.o lib_a-asinl.o lib_a-atan2l.o lib_a-coshl.o lib_a-sinhl.o lib_a-expl.o lib_a-ldexpl.o lib_a-logl.o lib_a-log10l.o lib_a-powl.o lib_a-sqrtl.o lib_a-fmodl.o lib_a-hypotl.o lib_a-copysignl.o lib_a-nanl.o lib_a-ilogbl.o lib_a-asinhl.o lib_a-cbrtl.o lib_a-nextafterl.o lib_a-rintl.o lib_a-scalbnl.o lib_a-exp2l.o lib_a-scalblnl.o lib_a-tgammal.o lib_a-nearbyintl.o lib_a-lrintl.o lib_a-llrintl.o lib_a-roundl.o lib_a-lroundl.o lib_a-llroundl.o lib_a-truncl.o lib_a-remquol.o lib_a-fdiml.o lib_a-fmaxl.o lib_a-fminl.o lib_a-fmal.o lib_a-acoshl.o lib_a-atanhl.o lib_a-remainderl.o lib_a-lgammal.o lib_a-erfl.o lib_a-erfcl.o 
sh-elf-ranlib lib.a
make[9]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/common'
Making all in complex
make[9]: Entering directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/complex'
sh-elf-gcc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh  -m4-single-only -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../newlib-1.19.0/newlib/libm/complex -I../../../../../../newlib-1.19.0/newlib/libm/complex/../common -I../../../../../../newlib-1.19.0/newlib/libm/complex/ -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls -fno-builtin      -g -O2  -m4-single-only -c -o lib_a-cabs.o `test -f 'cabs.c' || echo '../../../../../../newlib-1.19.0/newlib/libm/complex/'`cabs.c
sh-elf-gcc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh  -m4-single-only -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../newlib-1.19.0/newlib/libm/complex -I../../../../../../newlib-1.19.0/newlib/libm/complex/../common -I../../../../../../newlib-1.19.0/newlib/libm/complex/ -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls -fno-builtin      -g -O2  -m4-single-only -c -o lib_a-cacos.o `test -f 'cacos.c' || echo '../../../../../../newlib-1.19.0/newlib/libm/complex/'`cacos.c
sh-elf-gcc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh  -m4-single-only -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../newlib-1.19.0/newlib/libm/complex -I../../../../../../newlib-1.19.0/newlib/libm/complex/../common -I../../../../../../newlib-1.19.0/newlib/libm/complex/ -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls -fno-builtin      -g -O2  -m4-single-only -c -o lib_a-cacosh.o `test -f 'cacosh.c' || echo '../../../../../../newlib-1.19.0/newlib/libm/complex/'`cacosh.c
sh-elf-gcc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh  -m4-single-only -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../newlib-1.19.0/newlib/libm/complex -I../../../../../../newlib-1.19.0/newlib/libm/complex/../common -I../../../../../../newlib-1.19.0/newlib/libm/complex/ -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls -fno-builtin      -g -O2  -m4-single-only -c -o lib_a-carg.o `test -f 'carg.c' || echo '../../../../../../newlib-1.19.0/newlib/libm/complex/'`carg.c
sh-elf-gcc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh  -m4-single-only -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../newlib-1.19.0/newlib/libm/complex -I../../../../../../newlib-1.19.0/newlib/libm/complex/../common -I../../../../../../newlib-1.19.0/newlib/libm/complex/ -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -fno-crossjumping -fno-optimize-sibling-calls -fno-builtin      -g -O2  -m4-single-only -c -o lib_a-casin.o `test -f 'casin.c' || echo '../../../../../../newlib-1.19.0/newlib/libm/complex/'`casin.c
../../../../../../newlib-1.19.0/newlib/libm/complex/casin.c: In function `casin':
../../../../../../newlib-1.19.0/newlib/libm/complex/casin.c:165: error: unable to find a register to spill in class `FP0_REGS'
../../../../../../newlib-1.19.0/newlib/libm/complex/casin.c:165: error: this is the insn:
(insn:HI 199 198 201 0 ../../../../../../newlib-1.19.0/newlib/libm/complex/casin.c:165 (parallel [
            (set (reg:SF 65 fr1 [ <result>+4 ])
                (plus:SF (mult:SF (reg:SF 70 fr6 [281])
                        (reg:SF 69 fr5 [291]))
                    (reg:SF 68 fr4 [290])))
            (use (reg/v:PSI 151 ))
        ]) 239 {*macsf3} (insn_list 178 (nil))
    (expr_list:REG_DEAD (reg:SF 68 fr4 [290])
        (expr_list:REG_DEAD (reg:SF 70 fr6 [281])
            (expr_list:REG_DEAD (reg:SF 69 fr5 [291])
                (nil)))))
../../../../../../newlib-1.19.0/newlib/libm/complex/casin.c:165: confused by earlier errors, bailing out
make[9]: *** [lib_a-casin.o] Error 1
make[9]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/complex'
Making all in machine
make[9]: Entering directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/machine'
Making all in .
make[10]: Entering directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/machine'
make[10]: Nothing to be done for `all-am'.
make[10]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/machine'
make[9]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm/machine'
make[9]: Entering directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm'
rm -f libm.a
rm -rf tmp
mkdir tmp
cd tmp; \
	  for i in math/lib.a common/lib.a complex/lib.a ; do \
	    sh-elf-ar x ../$i; \
	done; \
	sh-elf-ar rc ../libm.a *.o
sh-elf-ar: ../complex/lib.a: No such file or directory
sh-elf-ranlib libm.a
rm -rf tmp
make[9]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm'
make[8]: *** [all-recursive] Error 1
make[8]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib/libm'
make[7]: *** [all-recursive] Error 1
make[7]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib'
make[6]: *** [all] Error 2
make[6]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/m4-single-only/newlib'
make[5]: *** [multi-do] Error 1
make[5]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib'
make[4]: *** [all-multi] Error 2
make[4]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib'
make[2]: *** [all-target-newlib] Error 2
make[2]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0'
Any ideas ?
ImageAlice Dreams Tournament Dreamcast fans : http://www.facebook.com/alicedreamst
In August 2015, we had to change "Dynamite Dreams" name to "Alice Dreams Tournament"
Dreamcast
DCEmu Freak
DCEmu Freak
Posts: 81
Joined: Fri Jul 27, 2007 2:23 am
Has thanked: 2 times
Been thanked: 4 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Dreamcast »

Edit: (that wasn't it).
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

That's a rather odd error that GCC shouldn't be spitting out. It looks to me like your native compiler didn't compile the sh-elf-gcc properly for stage1.

Although, its also a bit odd that its passing -m4-single-only to the compiler at that point. The way I had things set up (and the way it built on my machine), -ml -m4-single-only is assumed to be the default, so neither of them are needed for the Dreamcast (they're effectively dummy switches).
patbier
DC Developer
DC Developer
Posts: 152
Joined: Fri Aug 29, 2003 1:25 am
Has thanked: 0
Been thanked: 0

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by patbier »

Ok, I surely found the problem, I tried to build the new toolchain and I forgot to comment the environ.sh in the .profile
So I had the -m4-single-only in one variable.

I tried to rebuild but another error in build-newlib-sh-elf-1.19.0.log :

Code: Select all

=== configuring in sh (/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/libc/machine/sh)
configure: running /bin/sh ../../../../../../newlib-1.19.0/newlib/libc/machine/sh/configure --disable-option-checking '--prefix=/usr/local/dc2011/sh-elf'  '--with-newlib' '--enable-multilib' '--with-cross-host=i686-pc-cygwin' '--with-multilib-list=m4-single-only,m4-nofpu,m4' '--with-endian=little' '--with-cpu=m4-single-only' '--program-transform-name=s&^&sh-elf-&' '--with-target-subdir=sh-elf' '--build=i686-pc-cygwin' '--host=sh-elf' '--target=sh-elf' 'build_alias=i686-pc-cygwin' 'host_alias=sh-elf' 'target_alias=sh-elf' 'CC=sh-elf-cc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh   ' 'CFLAGS=-g -O2' 'LDFLAGS=' 'CPPFLAGS=' --cache-file=../../.././config.cache --srcdir=../../../../../../newlib-1.19.0/newlib/libc/machine/sh
configure: loading cache ../../.././config.cache
checking build system type... (cached) i686-pc-cygwin
checking host system type... (cached) sh-unknown-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for sh-elf-strip... (cached) sh-elf-strip
checking for a thread-safe mkdir -p... (cached) /usr/bin/mkdir -p
checking for gawk... (cached) gawk
checking whether make sets $(MAKE)... (cached) yes
checking for style of include used by make... GNU
checking for gcc... (cached) sh-elf-cc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh   
checking dependency style of sh-elf-cc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh   ... (cached) none
checking whether we are using GNU C... (cached) no
checking for sh-elf-as... (cached) sh-elf-as
checking for sh-elf-ar... (cached) sh-elf-ar
checking for sh-elf-ranlib... (cached) sh-elf-ranlib
checking for sh-elf-readelf... (cached) sh-elf-readelf
checking whether to enable maintainer-specific portions of Makefiles... no
checking for sh-elf-gcc... (cached) sh-elf-cc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/targ-include -isystem /home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/sh -L/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss/sh   
checking whether we are cross compiling... yes
checking for suffix of object files... configure: error: in `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/libc/machine/sh':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
configure: error: ../../../../../../newlib-1.19.0/newlib/libc/machine/sh/configure failed for sh
configure: error: ../../../../../newlib-1.19.0/newlib/libc/machine/configure failed for machine
configure: error: ../../../../newlib-1.19.0/newlib/libc/configure failed for libc
make[2]: *** [configure-target-newlib] Error 1
make[2]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0'
and the config.log :

Code: Select all

configure:4018: checking whether we are cross compiling
configure:4056: result: yes
configure:4060: checking for suffix of object files
configure:4082: sh-elf-cc -B/home/Julien/cacdev2011/kos/utils/dc-chain/build-new
lib-sh-elf-1.19.0/sh-elf/newlib/ -isystem /home/Julien/cacdev2011/kos/utils/dc-c
hain/build-newlib-sh-elf-1.19.0/sh-elf/newlib/targ-include -isystem /home/Julien
/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/newlib/libc/include -B/home/Julien/
cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgloss/sh -L/h
ome/Julien/cacdev2011/kos/utils/dc-chain/build-newlib-sh-elf-1.19.0/sh-elf/libgl
oss/libnosys -L/home/Julien/cacdev2011/kos/utils/dc-chain/newlib-1.19.0/libgloss
/sh    -c -g -O2  conftest.c >&5
../../../../../../newlib-1.19.0/newlib/libc/machine/sh/configure: line 4084: sh-
elf-cc: command not found
configure:4086: $? = 127
Any ideas ?
ImageAlice Dreams Tournament Dreamcast fans : http://www.facebook.com/alicedreamst
In August 2015, we had to change "Dynamite Dreams" name to "Alice Dreams Tournament"
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

That is another odd one... With that one, its apparently not picking up on your sh-elf-gcc from stage 1 of building GCC. Try putting the path to the binaries you're building (I'm guessing its /usr/local/dc2011/sh-elf/bin from what I see) in your PATH, and try again.
patbier
DC Developer
DC Developer
Posts: 152
Joined: Fri Aug 29, 2003 1:25 am
Has thanked: 0
Been thanked: 0

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by patbier »

ok I found the problem ! Looking at the log files, I found this line :

Code: Select all

pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld.exe
build-gcc-sh-elf-4.5.2-pass1.log:configure: error: Building GCC requires GMP 4.2
+, MPFR 2.3.1+ and MPC 0.8.0+.
libmpc wasn't installed. The previous toolchain didn't need it.
I had to install libelf too.

I hope this can help someone else ;)

Now I have to test my games with this toolchain to see if it works, and if it gives improvements.
ImageAlice Dreams Tournament Dreamcast fans : http://www.facebook.com/alicedreamst
In August 2015, we had to change "Dynamite Dreams" name to "Alice Dreams Tournament"
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has thanked: 0
Been thanked: 2 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Chilly Willy »

Updating the kos repo gives an error:
svn: Checksum mismatch while updating 'kos/utils/dc-chain/download.sh'; expected: '37904c4db41d3c6be46c9b571c385ae1', actual: 'bb2c2c38833bae23a4228289009d08d9'
User avatar
Christuserloeser
Moderator
Moderator
Posts: 5948
Joined: Thu Aug 28, 2003 12:16 am
Location: DCEvolution.net
Has thanked: 10 times
Been thanked: 0
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Christuserloeser »

Could someone help us out ? What might be the problem ?
Insane homebrew collector.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by BlueCrab »

I don't get any errors when trying to do a svn update. Sourceforge was having some problems with some of their systems, so you might just want to try again...

If that doesn't work, the only thing I can suggest is doing a clean checkout of the entire repo again to see if that works.
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has thanked: 0
Been thanked: 2 times

Re: Building a 4.5.2 toolchain for MINGW WIN32 (tutorial)

Post by Chilly Willy »

I renamed the old dir and did a brand new checkout... which went through. Thanks.

One problem down, 100 more to go. :wink: :grin:
Post Reply