|
|
|
|
|
Maintaining code with multiple compilers |
First, you need to tell SRT where to find the actuall compilers. Probably the best (and most "official" way) to do this is to create an SRT_SITE directory in the release directory which holds SRT .mk files which override some of SRT's MAKE variables. Alternatively you can forget all about this SRT_SITE stuff and simply select the compiler by making sure it is found first in your PATH variable. For the rest of this doc, it is assumed to use the SRT_SITE redirection method.
You can either create this SRT_SITE subdirectory directly in the release directory, or you might want to put this into a local CVS repository and integrate it into SRT's package system. Doing the latter is described here.
After that is setup, you need to tell SRT to use a compiler other than the default. This is done by passing in extra things to srt_setup.
Of course, you must also rebuild any C++ 3rd party packages (C and FORTRAN ones should still work). You should do this before rebuilding MINOS code. Suggestions on how to manage this are given at the end.
Finally, if you are using msrt you must tell it to use your environment instead of its own.
cvs -d some_cvsroot import -m "Some comment" SRT_SITE some_name some_tag
mkdir $SRT_DIST/packages/SRT_SITE cd $SRT_DIST/packages/SRT_SITE echo "some_cvsroot" > cvsroot # needed by SRT later cvs -d `cat cvsroot` get -d HEAD SRT_SITE addpkg -p SRT_SITE HEADYou will now have an empty SRT_SITE package.
cd $SRT_DIST/releases/development/SRT_SITE mkdir special cvs add special cd special mkdir compilers cvs add compilers cd compilers
You should be in the compilers/ subdir for the next steps.
Other systems may do it differently, however in general, as long as the correct compiler executable is called, everything else should work. If you are not on a Debian system but you still have multiple GCCs installed under their generic names, you can still differentiate them by giving the full paths to their executables.
Anyways, here are the files for 3 of the GCCs currently available (egcs is not shown and left as an exercise for any dinosaurs out there):
cat <<EOF >GCC_2_95.mk CPP=g++-2.95 CXX=g++-2.95 GCC=gcc-2.95 SHAREDAR=gcc-2.95 EOF
cat <<EOF >GCC_3_0.mk CPP=g++-3.0 CXX=g++-3.0 GCC=gcc-3.0 SHAREDAR=gcc-3.0 EOF
cat <<EOF >GCC_3_1.mk CPP=g++-3.1 CXX=g++-3.1 GCC=gcc-3.1 SHAREDAR=gcc-3.1 EOF
cvs add GCC_2_95.mk GCC_3_0.mk GCC_3_1.mk cvs commit -m "some message" GCC_2_95.mk GCC_3_0.mk GCC_3_1.mk
srt_setup SRT_CXX=GCC_3_1
cd SRT_DIST/releases/development/Algorithm make MINOS_VERBOSE=yes -n allYou should see the correct g++-3.1 being used.
srt_setup SRT_CXX=GCC_3_1
msrt -e update msrt -e build
msrt release -r RX.Y.Z msrt update -r RX.Y.Z SRT_SITE msrt build -r RX.Y.Z
my_basic_setup () {
ver=$1
if [ -z "$ver" ] ; then ver="2.95"; fi
export CC=gcc-$ver
export CXX=g++-$ver
export CPP=cpp-$ver
export F77=g77-$ver
export ROOTSYS=/home/bviren/cvs/root/$CC
PATH=$ROOTSYS/bin:$PATH
export SIGC_DIR=/home/bviren/lib/sigc-1.1.11-$CC
export LD_LIBRARY_PATH=$ROOTSYS/lib:$SIGC_DIR/lib:$LD_LIBRARY_PATH
}
my_srt_setup () {
ver=$1
if [ -z "$ver" ] ; then ver="GCC_2_95"; fi
srt_setup SRT_CXX=$ver
}
my_setup () {
version=$1
if [ -z "$version" ] ; then version="3.1"
my_basic_setup $version
my_srt_setup GCC_`echo $gcc_ver | tr '.' '_'`
}
After sourceing, type
bash> my_setup 3.1Doing
bash> env | egrep "CC|CXX|CPP|ROOTSYS|F77"Should show various variables, all with the same version.
Note that this overrides some things normally set in the setup_minossoft files, so you should source this after sourcing the standard one.
Also note that in the case of SIGC_DIR, we are setting a compiler specific location. This must of course match where we installed it. See below for details.
./configure linux \ --with-ttf-fontdir=/usr/share/fonts/truetype \ --with-ttf-incdir=/usr/include/freetype \ --with-xpm-libdir=/usr/X11R6/lib
make make install which root root
./configure --prefix=/home/bviren/lib/sigc-1.1.11-gcc-3.1This matches the setting above.
Last Modified: $Date: 2002/11/22 19:33:00 $
Contact:
bv@bnl.gov
Page viewed from
http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/msrt-multi-compilers.html
| Security, Privacy, Legal |
|