Compiling the mipsel-linux ToolChain for Cygwin (Win32)

Downloading pre-build binaries

If you are only interested in the final result and do not want to compile your own toolchain from source go here

Detailed build instructions

OK, you want to try it yourself ? Watch out for commands that might be split over multiple lines in your browser (especially the 'configure' commands). Use tar as indicated, and do not try to use WinZip: at first it seems to work as well, but you'll find out the hard way that it does not handle symlinks correctly.
Here we gooooo...

Download and install Cygwin-B20.1
from here http://www.wapuniverse.com/agenda/dist/cygwin-b20.1-full.exe
  (I got it from http://www.palmos.com/dev/tech/tools/gcc/dist/cygwin-b20.1-full.exe)
The instructions below assume you use the bash shell.
Create a working directory, e.g. :
   mkdir /dev/Agenda/toolchain/
and a place to store all the downloaded files :
   mkdir /dev/Agenda/toolchain/dist/

Download and install autoconf
from here http://www.wapuniverse.com/agenda/dist/autoconf-2.13.tar.gz
  (I got it from ftp://ftp.easynet.be/cygwin/latest/autoconf/autoconf-2.13.tar.gz)
Just unzip into / to install.

Get the toolchain sources
http://www.wapuniverse.com/agenda/dist/cross-binutils-2.8.1-2lv.src.rpm
  (I got it from ftp://ftp.agendacomputing.com/agenda/tools/SRPMS/cross-binutils-2.8.1-2lv.src.rpm)
http://www.wapuniverse.com/agenda/dist/cross-egcs-1.0.3a-3lv.src.rpm
  (I got it from ftp://ftp.agendacomputing.com/agenda/tools/SRPMS/cross-egcs-1.0.3a-3lv.src.rpm)
http://www.wapuniverse.com/agenda/dist/glibc-devel-mipsel-linux-2.0.7sf-20lv.i386.rpm
  (I got it from ftp://ftp.agendacomputing.com/agenda/tools/RPMS/i386/glibc-devel-mipsel-linux-2.0.7sf-20lv.i386.rpm)
http://www.wapuniverse.com/agenda/dist/kernel-headers-mipsel-linux-2.4.0-test9-1lv.i386.rpm
  (I got it from ftp://ftp.agendacomputing.com/agenda/tools/RPMS/i386/kernel-headers-mipsel-linux-2.4.0-test9-1lv.i386.rpm)
http://www.wapuniverse.com/agenda/dist/egcs-1.0.3a-cygwin-unofficial.patch.gz
  (I got it from http://www.yk.rim.or.jp/~nanashi/agenda/egcs-1.0.3a-cygwin-unofficial.patch.gz)

Transform the RPM's into tar.gz
I used a Linux box for this:
   mkdir var var/lib var/lib/rpm usr usr/src usr/src/redhat
   rpm -ivh --nodeps --noscripts --notriggers --ignorearch --root=`pwd` *.rpm


Compile binutils:
   cd /dev/Agenda/toolchain/
   tar -zxf dist/cross-binutils-2.8.1-2lv.src.tar.gz
   cd binutils-2.8.1
   patch -p1 < ../binutils-2.8.1-mips1.patch
   patch -p1 < ../binutils-2.8.1-mips2.patch
   patch -p1 < ../binutils-2.8.1-loaddelay-2.patch
   mkdir build-mipsel-linux
   cd build-mipsel-linux
   ../configure --with-include-gettext --target=mipsel-linux --host=i386-pc-cygwin32 --build=i386-pc-cygwin32 --prefix=/usr -v
   make
   cd binutils
   for i in `ls *.exe` ; do mv -f $i `echo $i | sed -e 's/.exe/./'` ; done
   cd ..
   mkdir /tmp/usr
   make prefix=/tmp/usr install
   cd /tmp
   tar -zcvpf /dev/Agenda/toolchain/dist/mipsel-linux-win32-binutils-2.8.1.tgz usr
   # cleanup the mess we left behind
   rm -rf usr
   cd /dev/Agenda/toolchain/
   rm -rf binutils-2.8.1 cross-binutils-2.8.1.spec
   rm -f binutils-2.8.1-loaddelay-2.patch binutils-2.8.1-mips1.patch binutils-2.8.1-mips2.patch


    and install the freshly created mipsel-linux-win32-binutils-2.8.1.tgz into your /usr

Install the kernel header files and glibc:
I installed the ones from the Agendacomputing ftp site on my Linux box, and moved them over to my Win32 machine.
   cd /
   tar -zxvpf /dev/Agenda/toolchain/dist/kernel-headers-mipsel-linux-2.4.0-test9-1lv.tar.gz
   tar -zxvpf /dev/Agenda/toolchain/dist/glibc-devel-mipsel-linux-2.0.7sf-20lv.tar.gz


Install the header files and libraries from Bradley D. LaRonde (AgendaComputing):
   cd /usr/mipsel-linux
   gunzip < /dev/Agenda/toolchain/dist/brads-mipsel-linux-include.tar.gz | tar x
   gunzip < /dev/Agenda/toolchain/dist/brads-mipsel-linux-lib.tar.gz | tar x

    WARNING: this last step creates cyclic links in the FL includes (because Win32 is NOT case sensitive, and there where a lot of links like Fl.h -> Fl.H , which is basically the same file on Win32). I extracted them on a linux box, removed all the links that where causing problems, and moved the result over to my WIN32 box.

Compile egcs:
   cd /dev/Agenda/toolchain/
   tar -zxvpf dist/cross-egcs-1.0.3a-3lv.src.tar.gz
   bzip2 -cd egcs-1.0.3a.tar.bz2 | tar -xvf -
   cd egcs-1.0.3a
   patch -p1 < ../egcs-1.0.3a-mips.patch
   patch -p1 < ../egcs-1.0.3a-mips-softfloat-2.patch
   patch -p1 < ../egcs-1.0.3a-sgidefs.patch
   cat ../dist/egcs-1.0.3a-cygwin-unofficial.patch | patch -p1
   mkdir build-mipsel-linux
   cd build-mipsel-linux
   ../configure --enable-languages=c,c++ --with-include-gettext --disable-shared --enable-threads --target=mipsel-linux --host=i386-pc-cygwin32 --build=i386-pc-cygwin32 --prefix=/usr -v
   make
   make prefix=/tmp/usr install
   cd /tmp
   tar -zcvpf /dev/Agenda/toolchain/dist/cross-egcs-win32-1.0.3a-3lv.tgz usr


NOTE: under win95 or 98, you need to change the extension of all the files under /usr/mipsel-linux/bin to *.exe. Otherwise it brings up nasty errors about not finding files. Thanks to dopple@why-bother-me.com for pointing this out. I'll fix this in the next binary distribution.

Test the toolchain:
   mipsel-linux-gcc HelloWorld.c -o HelloWorld

Caveats:
I had to fiddle with the configure settings, some problems with 'info'-files, and cyclic links in the FL includes (because Win32 is NOT case sensitive, and there where a lot of links like Fl.h -> Fl.H , which is basically the same file on Win32)

© 2001 Filip Onkelinx. All trademarks and copyrights on this page are owned by their respective owners.