The problem

A well-known tool to build crosscompilers is Dan Kegel's Crosstool. It is unparallelled in ease of use: it works right out of the box, automatically taking care of downloading any dependencies as it goes.

However, on Ubuntu 9.04 it doesn't seem to work quite as well. At least when compiling a GCC crosscompiler for the Alpha ISA (using the default script), some errors may occur during compilation. For example, this is the one I've commonly encountered:

In file included from version.c:33:
crosstool-0.43/build/alpha-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.6/build-glibc/csu/version-info.h:2: error: missing terminating " character
crosstool-0.43/build/alpha-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.6/build-glibc/csu/version-info.h:3: error: missing terminating " character
version.c:40: error: syntax error before string constant

This error is caused by differences in echo behaviour between Ubuntu's dash shell and the actual bash shell. By default, Ubuntu symlinks /bin/sh to the dash shell; because dash implements a subset of the bash shell, this allows for faster startup times. However, it also implies that shell scripts that specify /bin/sh or that are started using sh <script> will also be executed under dash.

So apparently, there are some differences in echo behaviour between the dash shell and the bash shell, causing the quotes to get messed up and compilation to fail.

The fix

The solution is simple enough: run the script under /bin/bash instead of /bin/sh, or otherwise relink /bin/sh to /bin/bash. With root privileges, the latter is done as such:

# cd /bin
# mv sh sh.orig; ln -s /bin/bash sh

And if afterwards you want to restore the default settings, use this:

# cd /bin
# rm sh; mv sh.orig sh

You should now be able to run crosstool without further problems.