When dealing with different versions of a program (e.g. uclibc or glibc based cross compilers), you sometimes want to easily switch between them. In the past I used small env.sh files which contained the necessary additions to PATH and other environment settings. Because settings were never undone, this sometimes led to difficult to find problems.
When a former colleague showed me modules, these problems became a thing of the past: whenever I come to a situation were I previously wrote an env.sh or changed my .bashrc, I now write a modulefile. It’s a pity this software isn’t packaged inside debian (or I must have overlooked it). Therefore a quick installation guide:
wget http://heanet.dl.sourceforge.net/sourceforge/modules/modules-3.2.6.tar.bz2
tar xjvf modules-3.2.6.tar.bz2
cd modules-3.2.6
./configure
make
sudo make install
And add the following to your ~/.bashrc
. /usr/local/Modules/3.2.6/init/bash
module use ~/modules/
~/modules is the directory where I keep my modulefiles. For the codesourcery crosscompilers I currently have 2 files:
- cross-gcc/arm-2007q3-53-arm-none-eabi-i686-pc-linux-gnu
#%Module1.0
setenv ARCH arm
setenv CROSS_COMPILE arm-none-eabi-
prepend-path PATH /home/jan/no_backup/tools/arm-2007q3-53-arm-none-eabi-i686-pc-linux-gnu/arm-2007q3/bin/
- cross-gcc/arm-2007q3-51-arm-uclinuxeabi
#%Module1.0
setenv ARCH arm
setenv CROSS_COMPILE arm-uclinuxeabi-
prepend-path PATH /home/jan/no_backup/tools/arm-2007q3-51-arm-uclinuxeabi-i686-pc-linux-gnu/arm-2007q3/bin
Now I can use:
module avail
module load cross-gcc/arm-2007q3-51-arm-uclinuxeabi
module list
module unload cross-gcc