Re: [ROOT] How to specify the compiler

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Aug 30 2002 - 13:00:47 MEST


Hi Edward,

On Thu, 29 Aug 2002 17:14:11 -0700 (PDT)
Edward Chen <edward@SLAC.stanford.edu> wrote
concerning "[ROOT] How to specify the compiler":
> Hi - if I have a different compiler in a different directory, is
> there a way to tell ROOT to use that compiler?  Thanks. 

Watch out when you're mixing compilers.  The different C++ compilers
have different mangling schemes [1] (except the ones that follows the
Intel C++ ABI standard, which to my knowledge only includes GCC and
Intel's C++ compilers), with the result that code compiled with
compiler A can not be used with code compiled by compiler B. 

This may sound stupid, in which case you're right.  The issue is
largely historical.  In C++ ARM (C++ Annotated Reference Manual - the
original Stroustrup design), it was actually recommended that
compilers implemeted different mangling schemes, to avoid
incompatibilities.  Now that was all well and fine back when C++
wasn't a standard and compilers couldn't be expected to behave
comformingly.  

However, now we _have_ a standard, and the incompatibilities is
non-issue: if a compiler doesn't implement the standard, it's simply
not a C++ compiler. There's actually very few `C++ compilers' that are 
remotely close to implementing the standard: GCC and Intel's C++
compilers are some of them.  Other `compilers' are way off, like MSVC,
KCC, and so on. According to this [2] Micros**t will not even try to
make MSVC to compliant with the standard! There's no, to the best of
my knowledge, any one compiler that really implments the standard -
except perhaps if Bjarne Stroustrup has one, but he's not talking.

If your really question is:  How do I compile ROOT with a compiler
that's not the default for my platform, the first thing you should do,
is to run 

  ./configure --help 

and check the list of Os-architecture-compiler combinations that are
directly supported.  For example, you'll see 

  linux                for Linux egcs 1.1.x, gcc 2.9x, gcc 3.x and glibc
  linuxalphaegcs       for Alpha Linux egcs and glibc
  linuxarm             for ARM Linux egcs and glibc
  linuxdeb             for Debian GNU/Linux v2.1+ gcc and glibc
  linuxdeb2            for Debian GNU/Linux v2.0 egcs and glibc
  linuxdeb2ppc         for PPC Linux based on Debian v2.0
  linuxia64ecc         for Itanium Linux Intel ecc and glibc
  linuxia64gcc         for Itanium Linux gcc 2.9x and glibc
  linuxia64sgi         for Itanium Linux sgiCC and glibc
  linuxicc             for Linux Intel's icc and glibc
  linuxkcc             for Linux KAI's KCC and glibc
  linuxpgcc            for Linux pgcc and glibc
  linuxppcegcs         for PPC Linux egcs and glibc
  linuxrh42            for Linux gcc 2.7.x.x and libc5
  linuxrh51            for Linux gcc 2.7.x.x and glibc
  linuxsuse6           for Linux (SuSE v6.0) egcs and glibc

The assumption of architecture for the Linux targets, except where
explicitly noted, is that it's an i386. 

[BTW, I really don't like the implication of the `linux' target, that
Red Hat is the `true' or whatever GNU/Linux.  Anyway, that target
should work for most GNU/Linux distributions, as most of them are now
using GCC-2.95.x or better.] 

If you do not find you're os-architecture-compiler combination, try to
write an appropiate `config/Makefile.<os-architecture-compiler>' and
add the `os-architecture-compiler' identifier to the file
`config/ARCHS'.  If you get it to work, please send a patch to 
`rootdev@root.cern.ch' so that others may benefiet from your wisdom. 

You can also try to simply override the settings when you build: 

    prompt> ./configure linux 
    prompt> make CC=my-c-compiler CXX=my-c++-compiler 
    prompt> make install CC=my-c-compiler CXX=my-c++-compiler 

This may help you make the
`config/Makefile.<os-architecture-compiler>' file. 

If your question is along the lines: I have installed GCC-x.yy.zz in
`/some/where/bin/gcc' and I want to use that instead of
`/usr/bin/gcc', then you simply need to put `/some/where/bin' into
your PATH environment variable _before_ `/usr/bin'.  

Hope that helps you. 

Yours, 

 ____ |  Christian Holm Christensen 
  |_| |	 -------------------------------------------------------------
    | |	 Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|	          DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|	          Denmark                    Office: (+45) 353  25 305
 ____|	 Email:   cholm@nbi.dk               Web:    www.nbi.dk/~cholm
 | |


[1] If you don't know what `mangling means', look at the posts found
    by the search
http://www.google.com/custom?hl=en&lr=&ie=ISO-8859-1&cof=L%3Ahttp%3A%2F%2Froot.cern.ch%2Froot%2Fimages%2Frooticon.gif%3BAH%3Acenter%3B&domains=root.cern.ch&q=
[2] http://www.codeproject.com/interview/stanlippman14nov2001.asp



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET