[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: choosing among installed gcc versions



On Tue, 15 Apr 2003, Noah Meyerhans wrote:

> I should probably know this by now, but is there an automatic way of
> specifying which installed version of gcc will be run when the 'gcc'
> command is executed?
>
> By default, /usr/bin/gcc points to gcc-3.2 (on sid, anyway), and I could
> change it to point to gcc-2.95.  But would I also have to update
> /usr/bin/cpp?  Are there other things, too?
>

I suppose it depends upon what you want to do, but the way I would (and
have) done this is to specify in my Makefiles which version of gcc to use.
Here is an excerpt of a Makefile showing this on a woody system (where
2.95 is the basic gcc version).

CPP   = /usr/bin/g++-3.0
CC    = /usr/bin/gcc-3.0
LINK  = /usr/bin/g++-3.0
CLINK = /usr/bin/gcc-3.0
AR    = /usr/bin/ar
AS    = /usr/bin/as
RANLIB = /usr/bin/ranlib


It seems that each Debian version has a basic gcc version to be used, and
this is '/usr/bin/gcc'. There may be a newer or older gcc package that can
be installed, and if you want to use that version, its my opinion that
correct way to do this is to change the gcc seen by the Makefile(s) for
the software module you are compiling. There are several ways to do this,
adding explicit commands as I've shown above, setting an environment
variable in the shell that sets these, etc. Some of this depends upon the
structure of the Makefile(s) for the package you are compiling.




Reply to: