Re: [ROOT] How to specify the compiler

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Aug 30 2002 - 18:04:08 MEST


Hi Brett et al, 

On Fri, 30 Aug 2002 11:35:34 -0400
Brett Viren <bv@bnl.gov> wrote
concerning "Re: [ROOT] How to specify the compiler":
> Christian Holm Christensen writes:
>  > If your really question is:  How do I compile ROOT with a compiler
>  > that's not the default for my platform,
> ...
>  > 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 
> 
> Yes, this should work but you will also need to add 
> 
> 	LD=my-c++-compiler      (use g++-whatever, *not* just ld)

If the compiler can link :-) 

A compiler needn't be able to do linking.  All a compiler is required
(at the minimum), is to turn source code into assembler code.  Then it
may be the job of an assembler to turn the assembler code into object
files. A linker can then link the object files, libraries, ladida to
form an executable or shared library.  But one can also use an
archiver to make an object file library a.k.a. a static library.

That said, most compilers do know how to link, by calling the linker
proper.  Try give GCC the option `-v' and see what really goes on in
the link/compile.  Oddly enough, the following doesn't work: 

  > cat foo.c 
  int foo = 1;
  > cat bar.c 
  int bar = 2;
  > gcc -c foo.c 
  > gcc -c bar.c 
  > gcc -o libfoobar.a foo.o bar.o 

GCC thinks it's to produce an executable.  It's odd that the GCC
frontend doesn't know how to make archives as it knowns how to make
shared libraires. 

> and
> 	F77=my-f77-compiler 

Assuming ofcourse that you have CERNLIB installed on your machine
(why? You got ROOT, what else do you need :-), or didn't pass the
`--disable-cern' to `configure'.  
 
> and you may need to tweek F77LIBS (for GCC 3.2 on Debian at least) to
> include -lfrtbegin (just to get g2root exec).

and h2root too right?  :-) 

BTW, most systems do not have G++ installed as `g++-XXX' but rather as
`g++' (On Red Hat 7.3, GCC 3.0 is installed as `g++3').  Brett likes
to live dangerously and runs Debian GNU/Linux testing (or is it
unstable?) which I for one don't have the guts to do. 

Another way to specify the GCC version to use, is to use the `-V'
option to `gcc' & co., like 

  > gcc -V egcs-2.91.66
  > gcc -V 2.95.4 
  > gcc -V 3.02.4 
  > gcc -V 2.96 

This works for all proper installations of GCC, not just Debian.  The
latter is ofcourse not really GCC, but Red Hat's odd thing they passed
as GCC in the 7.x line.

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
 | |



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