Building and Testing gcc/glibc cross toolchains

Contents

Note: This page is out of date. See Crosstool-NG for a more up to date toolchain script.

Note: be sure to read crosstool-howto.html; that's the real doc.

Trouble in crosscompiler land

Building a gcc / glibc cross-toolchain for use in embedded systems development used to be a scary prospect, requiring iron will, days if not weeks of effort, lots of Unix and Gnu lore, and sometimes willingness to take dodgy shortcuts. This is a problem not only for individual users, but also for the gcc project as a whole, since the gcc team relies on users to test upcoming releases of gcc, and the difficulty of building the toolchain for embedded targets restricted the number of people able to help with the testing.

At Ixia, I had been maintaining a toolchain by starting with a commercial free embedded linux toolchain, and overlaying it with newer versions compiled from scratch as needed to fix problems. This became harder to maintain as time went on.

Enhancing the community build script

After some months of frustration, it became clear we needed an easy way to build and test gcc/glibc cross-toolchains from scratch. Looking around, I realized that Bill Gatliff's crossgcc FAQ and build script, what most of the community used to build cross-compilers, was almost what I needed, so I rolled up my sleeves and:

Results

I call my updated script and associated patches 'crosstool'. It's fairly easy to use and can be run unattended as part of an automatic build process, and should go a long way towards making it easier for the average developer to get started with gcc cross-compilers and help test new releases of gcc.

You can see from the build matrix included in the buildlogs directory of the crosstool tarball that many combinations of CPU, gcc, glibc, and Linux produce toolchains which can in fact compile user programs and the Linux kernel. You can also see which combinations don't work, and by clicking on their entries in the matrix, you can see the last 300 lines of the build log, including the error that stopped the toolchain or kernel build.

(I used to have test results here for some embedded processors, but they're a bit out of date.)

Here are a few success reports from other users:

Actual comments from happy users:

Downloads

Picture of Dan Kegel

About the author

Dan Kegel is a software engineer currently employed by Google. He has been programming since 1978, and mentoring intern programmers since 1994. He served on the JSR-51 committee which helped add nonblocking I/O and file locking to the Java platform. His web site "The C10K Problem" is well-known among a small circle of internet server programmers, and his essay "The Case for Linux in Universities" has been translated into Spanish, Hindi, and Telugu. He maintains lalugs.org as a service to the Los Angeles Linux community. He thanks his wife Liz Fuller for her support and patience during his periodic save-the-world quests, Ixia for sponsoring the first four months of this work, Bill Gatliff for the original script, Kaz Kojima and Daniel Jacobowitz for supplying patches on the spot to solve various problems, and the many crosstool users who have submitted bug reports, fixes, and enhancements.

Last Change 7 Dec 2006
The latest copy of this document can be found at kegel.com/crosstool
Portions Copyright by Ixia, 2003
Portions Copyright by Google, 2003-2006
Crosstool is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

[Return to www.kegel.com]