Thomas Schwinge has written a shell script for building a complete cross-build environment for GNU/Hurd systems.
Find it in the incubator, cross-gnu/master branch.
Using
Read through it. Understand it. Only then use it by following the next steps.
Status
Please note that these cross toolchains does not yet encompass all of the functionality that native toolchains provide. For example, there is only support for C and C++ so far, but not for other languages. A bunch of fixes / enhancements of glibc are missing. We're working towards minimizing these differences, as well as towards pushing all patches upstream.
Supported Versions of Source Packages
This is outdated. Contact tschwinge.
The following ones are known to work. Others may work as well, but no guarantee is given. Always the preferred version is listed first.
-
CVS
binutils-2_20-branch
$ mkdir binutils-2_20-branch $ cd binutils-2_20-branch/ $ cvs -d:pserver:[email protected]:/cvs/src ↩ co -r binutils-2_20-branch binutils
The sources are rooted in
binutils-2_20-branch/src/
. Also use the above commands for updating, instead of the usualcvs update
.Release 2.22 or later from ftp://ftp.gnu.org/gnu/binutils/ should also be fine.
-
SVN
gcc-4_5-branch
$ svn co svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch
Patches:
Prepare:
$ ( cd gcc-4_5-branch/ && contrib/gcc_update --touch )
SVN
gcc-4_4-branch
$ svn co svn://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch
Patches:
Prepare:
$ ( cd gcc-4_4-branch/ && contrib/gcc_update --touch )
Releases of the 4.5 and 4.4 series from ftp://ftp.gnu.org/gnu/gcc/ should also be fine, but need the same set of patches as the
gcc-4_5-branch
needs.
-
Git
master
branch$ git clone ↩ git://git.sv.gnu.org/hurd/gnumach.git gnumach
Prepare:
$ ( cd gnumach/ && autoreconf -vi )
-
Git
master
branch$ git clone ↩ git://git.sv.gnu.org/hurd/mig.git mig
Prepare:
$ ( cd mig/ && autoreconf -vi )
-
Git
master
branch$ git clone ↩ git://git.sv.gnu.org/hurd/hurd.git hurd
-
Git
tschwinge/Peter_Herbolzheimer
branch$ git clone --no-checkout ↩ git://git.sv.gnu.org/hurd/libpthread.git libpthread $ cd libpthread/ $ git checkout origin/tschwinge/Peter_Herbolzheimer
Prepare:
$ ( cd libpthread/ && autoreconf -vi )
-
Git
tschwinge/Roger_Whittaker
branch$ git clone --no-checkout ↩ git://git.sv.gnu.org/hurd/glibc.git glibc $ cd glibc/ $ git checkout origin/tschwinge/Roger_Whittaker
Preparation
The raw source code trees are about 1 GiB.
Unpack the tarballs if you downloaded any.
Create a directory where the cross build shall be rooted in, and a src
subdirectory in there. Then create symbolic links for every of the above
packages: from src/PACKAGE
to where you stored or unpacked it. If you don't
intend to build several cross compilers or use the source trees otherwise, you
can also directly store the source trees in src/
. The source trees can be
shared between multiple cross build trees since the packages' build systems are
supposed not to modify the files in the source trees. Not all packages adhere
to that, but they fail to do so only for pre-processed documentation, etc.
Either make sure that cross-gnu-env
and cross-gnu
are found in $PATH
(~/bin/
, for example) or alternatively remember to use their full paths in
the following.
The system you're running the script on (the build system) needs to have
basic development tools installed, that is, a C compiler with libraries,
make
, and several more packages. If anything is missing, the cross-gnu
build will abort, and you have to install the missing dependencies and resume
the cross-gnu build.
Setting Up the Environment
Do this every time you intend to use the cross compiler:
$ ROOT=to/the/cross/build/root
$ . cross-gnu-env
This will set several environment variables, which are later used by (a) the
cross-gnu
script and (b) by you, the user of the cross compiler. $TARGET
will be set by the script, $PATH
will be adjusted, etc. See the
cross-gnu-env
file for all environment variables that are set, as well as
their default values. $ROOT
will be made an absolute path if it isn't
already.
Later, you'll be able to do things like ../configure --host="$TARGET"
, and the
cross compiler will be found automatically.
Creating the Cross Build Environment
This will need an additional 2 GiB.
After setting up the environment, just run cross-gnu
and watch the messages
flow by. In the end you should see a message: [...]/cross-gnu: Everything
should be in place now.
Staying Up-To-Date
You can re-run cross-gnu
to rebuild the parts of the sources that have
changed since the last run. This will save a lot of time compared to starting
from scratch again. Also, it is especially useful if you aren't working with
unpacked tarballs, but on CVS's / SVN's / Git's branches or want to quickly get
a new toolchain
with patches you applied to the source trees. However: do not use this
technique when doing major changes to the source trees, like switching from GCC
4.4 to GCC 4.5.