Difference between revisions of "Toolchains"

From LinuxMIPS
Jump to: navigation, search
(Added a stub for how to make your own cross compiling toolchain, mostly for the sake of my memory)
(MIPS SDE)
Line 1: Line 1:
 
A toolchain is a complete collection of compiler and binutils programs and can be run either as a cross-compiler, or native on the target (if performance allows).
 
A toolchain is a complete collection of compiler and binutils programs and can be run either as a cross-compiler, or native on the target (if performance allows).
  
== MIPS SDE ==
+
== MIPS SDE ==  
MIPS Technologies UK (formerly [[Algorithmics]]) maintain their own source tree for the toolchain components.  SDE combines all necessary GNU tools, is infrequently resynchronized with mainstream GNU releases (which inevitably have bugs for less widely used architectures such as MIPS) and focuses on providing the most reliable, best-performing compiler for the largest range of MIPS CPUs. The current SDE release is 5.03.06, and is based on [[GCC]] 2.96 with many local bug fixes and improvements. But if you are already using a GCC 3.x based MIPS toolchain then you should probably not try to ''downgrade'' to this version, due to ABI and library differences.
+
MIPS Technologies UK maintains their own source tree
 +
for the toolchain components.  SDE combines all necessary GNU tools,
 +
is infrequently resynchronized with mainstream GNU releases (which
 +
inevitably have bugs for less widely used architectures such as MIPS)
 +
and focuses on supporting the full range of ISAs, ASEs and cores, as
 +
well as providing the most reliable, best-performing compiler for the
 +
largest range of MIPS CPUs. The current SDE release is 6.02.03, and is
 +
based on [[GCC]] 3.4, but with many local bug fixes and
 +
improvements. Take care when upgrading from GCC 2.x or if downgrading
 +
from GCC 4.x, because there are issues of both source code and ABI
 +
compatibility.
  
 
The Linux/386 cross-compiler is available as a single file, in RPM format:
 
The Linux/386 cross-compiler is available as a single file, in RPM format:
 
                                                                                  
 
                                                                                  
; Linux/386 cross for little-endian target : ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-5.03.06-1.i386.rpm
+
; Linux/386 cross for little-endian target : ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6.02.03-1/mipsel-sdelinux-v6.02.03-1.i386.rpm
; Linux/386 cross for big-endian target : ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinuxeb-5.03.06-1.i386.rpm.
+
; Linux/386 cross for big-endian target : ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/mips-sdelinux-v6.02.03-1.i386.rpm.
  
 
The Linux/MIPS native compiler is organised into separate RPM files, mirroring the RedHat 7.x toolchain organisation:
 
The Linux/MIPS native compiler is organised into separate RPM files, mirroring the RedHat 7.x toolchain organisation:
  
 
; Native big-endian
 
; Native big-endian
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-binutils-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-binutils-v6.02.03-1.mips.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-c++-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-c++-v6.02.03-1.mips.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-cpp-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-cpp-v6.02.03-1.mips.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-gcc-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gcc-v6.02.03-1.mips.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-libstdc++-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gdb-v6.02.03-1.mips.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-libstdc++-devel-5.03.06-1.mips.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libgcc-v6.02.03-1.mips.rpm
 +
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-v6.02.03-1.mips.rpm
 +
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-devel-v6.02.03-1.mips.rpm
  
 
; Native little-endian
 
; Native little-endian
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-binutils-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-binutils-v6.02.03-1.mipsel.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-c++-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-c++-v6.02.03-1.mipsel.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-cpp-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-cpp-v6.02.03-1.mipsel.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-gcc-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gcc-v6.02.03-1.mipsel.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-libstdc++-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gdb-v6.02.03-1.mipsel.rpm
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-libstdc++-devel-5.03.06-1.mipsel.rpm
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libgcc-v6.02.03-1.mipsel.rpm
 +
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-v6.02.03-1.mipsel.rpm
 +
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-devel-v6.02.03-1.mipsel.rpm
  
To avoid conflicts with an existing '''native''' MIPS toolchain only, you can uninstall the old compiler and libstdcc
+
; Native install script : ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/install-native.sh
installations using these commands:
+
  
# rpm -e `rpm -q -f /usr/bin/gcc`
+
; Source package
# rpm -e `rpm -q -f /usr/include/g++-3/streambuf.h`
+
: ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-v6.02.03-1.src.rpm
  
The new sdelinux RPMs can then be installed in the normal way:
+
To avoid conflicts when installing the '''native''' MIPS toolchain
 +
only, you need to uninstall the old compiler and its support
 +
packages. This is most easily done by running the install-native.sh
 +
shell script listed above, which must be in the same directory as the
 +
rpm files. It will allow you to save your old toolchain package first,
 +
in case you need to uninstall SDE and revert.
  
  # rpm -Uv sdelinux-*-5.03.06-1*.rpm
+
The '''cross''' toolchain is installed simply using the rpm command,
 +
for example:
 +
 
 +
  # rpm -Uv mipsel-sdelinux-v6.02.03-1.i386.rpm
  
 
MTUK would like to hear how well it worked, so contact them on sde@mips.com.
 
MTUK would like to hear how well it worked, so contact them on sde@mips.com.

Revision as of 10:37, 23 July 2005

A toolchain is a complete collection of compiler and binutils programs and can be run either as a cross-compiler, or native on the target (if performance allows).

MIPS SDE

MIPS Technologies UK maintains their own source tree for the toolchain components. SDE combines all necessary GNU tools, is infrequently resynchronized with mainstream GNU releases (which inevitably have bugs for less widely used architectures such as MIPS) and focuses on supporting the full range of ISAs, ASEs and cores, as well as providing the most reliable, best-performing compiler for the largest range of MIPS CPUs. The current SDE release is 6.02.03, and is based on GCC 3.4, but with many local bug fixes and improvements. Take care when upgrading from GCC 2.x or if downgrading from GCC 4.x, because there are issues of both source code and ABI compatibility.

The Linux/386 cross-compiler is available as a single file, in RPM format:

Linux/386 cross for little-endian target 
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6.02.03-1/mipsel-sdelinux-v6.02.03-1.i386.rpm
Linux/386 cross for big-endian target 
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/mips-sdelinux-v6.02.03-1.i386.rpm.

The Linux/MIPS native compiler is organised into separate RPM files, mirroring the RedHat 7.x toolchain organisation:

Native big-endian
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-binutils-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-c++-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-cpp-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gcc-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gdb-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libgcc-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-v6.02.03-1.mips.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-devel-v6.02.03-1.mips.rpm
Native little-endian
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-binutils-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-c++-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-cpp-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gcc-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-gdb-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libgcc-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-v6.02.03-1.mipsel.rpm
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-libstdc++-devel-v6.02.03-1.mipsel.rpm
Native install script 
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/install-native.sh
Source package
ftp://ftp.mips.com/pub/tools/software/sde-for-linux/6,02.03-1/sdelinux-v6.02.03-1.src.rpm

To avoid conflicts when installing the native MIPS toolchain only, you need to uninstall the old compiler and its support packages. This is most easily done by running the install-native.sh shell script listed above, which must be in the same directory as the rpm files. It will allow you to save your old toolchain package first, in case you need to uninstall SDE and revert.

The cross toolchain is installed simply using the rpm command, for example:

# rpm -Uv mipsel-sdelinux-v6.02.03-1.i386.rpm

MTUK would like to hear how well it worked, so contact them on sde@mips.com.

Maciej W. Rozycki

A stable set of toolchain components provided by Maciej can be downloaded from ftp://ftp3.ds.pg.gda.pl/pub/macro/ or the mirror at ftp://ftp.rfc822.org/pub/mirror/ftp3.ds.pg.gda.pl/people/macro/. This is based on gcc 2.95.3 (patched) and up-to-date binutils.

Dan Kegel

Dan Kegel has a page at http://kegel.com/crosstool/ with a nice script to automatize the build procedure. Crosstool can only generate toolchains that use the GNU C Library, support for the smaller C Library http://www.uclibc.org uClibc might be added in the future.

H.J.Lu

H.J.Lu distributes a toolchain as part of his Red Hat 7.1 port. It can be found at ftp://ftp.linux-mips.org/pub/linux/mips/redhat/7.1/ . This toolchain-20020423-1.rpm is based on the RedHat's GCC 2.96, binutils 2.13 and glibc 2.2.5 .

uClibc Toolchain and Buildroot

uClibc developers provide tools to generate toolchains and root filesystems with the uClibc standard C library.

The Toolchain tool allows to generate a toolchain for a variety of architectures, including MIPS and MIPSel.

The Buildroot tool allows to generate both a toolchain and a root filesystem for a variety of architectures, including MIPS and MIPSel. Using a configuration tool (similar to the one used for the Linux Kernel), you can select compiler version, binutils version, and all softwares that should be included in the root filesystem. Then the Makefiles will automatically download, configure, compile, install and generate the toolchain and the root filesystem image.

OpenEmbedded

The OpenEmbedded meta distribution also includes an automatic build of a full cross-toolchain for it's target architecture. http://www.openembedded.org

Linux4.BE SDK

provides sources and precompiled toolcain binaries for Linux and Win32/Cygwin hosts: http://www.linux4.be/~jal0/

DENX ELDK

DENX Software Engineering provides the ELDK (Embedded Linux Development Kit), which includes both cross development and native tools for big and little endian MIPS processors (also for ARM and PowerPC). It can be downloaded for FREE. See http://www.denx.de/twiki/bin/view/DULG/ELDK

Commercial Toolchains

All commercial Linux/MIPS distributions come with appropriate toolchain deliverables.

A Quick and Dirty Cross-Compiling Toolchain

You're adverse to using someone else's toolchains, and are like me and cannot remember the commands to build a toolchain yourself no matter how hard you try, here is a rough procedure as to how to build a minimal toolchain with binutils-2.16.1 and gcc-3.4.4. This is assuming your buildhost is i386-linux.

1. Download the binutils and gcc sources from http://www.gnu.org
2. Create the directory where you want to store your toolchain. I recommend /opt/cross.
3. Extract binutils-2.16.1 and cd to the directory where it was extracted to
4. Run the following command to configure and make binutils:
./configure --target=mips64-unknown-linux-gnu --host=i386-unknown-linux-gnu --prefix=/opt/cross --enable-shared --enable-64-bit-bfd && make
5. Run make install to install binutils to /opt/cross
6. Now extract gcc-3.4.4 and run the following command to configure and make it:
AR=mips64-unknown-linux-gnu-ar RANLIB=mips64-unknown-linux-gnu-ranlib ./configure --prefix=/opt/cross --target=mips64-unknown-linux-gnu --host=i386-unknown-linux-gnu --with-newlib --disable-shared --disable-threads --enable-languages=c && make
7. Run make install to install gcc to /opt/cross

Now, whenever you are going to use your cross compiling toolchain, append /opt/cross/bin to your path.

See also