Fermilab


MINOS Offline Documentation
[home] [installing MINOS software] [supported platforms] [package links] [mailing list] [HyperNews] [FAQ] [computing help] [MINOS glossary] [archives]

Installing GCC From Source.




Installing GCC From Source

To install the gcc compiler from source, proceed as follows:-
  1. Get the tar file (e.g. gcc-3.2.tar.gz) from:-

    http://gcc.gnu.org/gcc-3.2/

  2. Install in a private directory like this (if not using 3.2 change the version numbers below):-
    
    #  Caution don't have SRT environment - it subverts make!!
    srt_setup --totally-unsetup
    
    set INSTALLATION_GCC = some-private-directory
    
    cd $INSTALLATION_GCC
    tar xzf gcc-3.2.tar.gz
    
    set srcdir = "$INSTALLATION_GCC/gcc-3.2"
    set objdir = "$INSTALLATION_GCC/gcc-bin"
    set insdir = "$INSTALLATION_GCC/usr/local"
    mkdir -p $srcdir
    mkdir -p $objdir
    mkdir -p $insdir
    cd $objdir
    $srcdir/configure --prefix=$insdir
    gmake bootstrap
    gmake install
    
    Don't install into the same directory as external libraries such as ROOT, as that results in compilation warnings when building MINOS code. The compiler is upset that its own (system) include directories are the same as the application ones but they are meant to be processed in a different order. It's probably benign.

  3. To select the compiler:-
        setenv PATH ${INSTALLATION_GCC}/usr/local/bin:${PATH}
        setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${INSTALLATION_GCC}/usr/local/lib
    
    Some say that the LD_LIBRARY_PATH isn't necessary; the compiler knows where to get its libraries. Others have found that sometimes executables give loader errors without that second line.

  4. Try out the new compiler:-
        gcc -v
        g++ -v
    
    should both say 3.2 (or whatever version you have chosen.)

    Try out on some trivial C++ code e.g.:-

    
    #include <iostream>
    using namespace std;
    
    int main() {
      try {
        throw "Help me";
      }
      catch(const char* p ) {
        cout << "Caught " << p  << endl;
      }
      return 0;
    }
    
    which when executed should say:-
    Caught Help me
    

  5. Root is a good first serious source to compile. If its executables work then it should all be plain sailing.
See also msrt with multiple compilers


Last Modified: $Date: 2007/04/26 14:23:56 $
Contact: minos_software_discussion@fnal.gov
Page viewed from http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/install_gcc.html
Fermilab
Security, Privacy, Legal Fermi National Accelerator Laboratory