How to use an older version of gcc?
bf1783 at googlemail.com
Thu Jan 28 15:57:17 UTC 2010
>yes i know i can call it gcc34 but the real problem is that the toolchain has
>some scripts to automate the building and it uses some paths to pick up the
>appropriate tools and when i run the scripts gcc42 is used. I figure out
>that the path that gcc42 is located is the same as gcc34 /usr/local/bin .
>But i don't know how to switch to the old gcc34 let's say for a particular
>user on my system.
I'm not sure why you would have lang/gcc42 installed on FreeBSD 8,
unless you needed certain extra components that didn't come with the
base system compiler, which is a patched version of gcc 4.2. Are you
sure your toolchain isn't using /usr/bin/cc or /usr/bin/gcc, instead
of /usr/local/bin/gcc42? And I'm not sure that it's a good idea to
use lang/gcc34, either. In any event, if you are determined to do
this, you could try defining:
setenv CC gcc34
setenv CPP cpp34
alias cc gcc34
alias gcc gcc34
alias cpp cpp34
and so on, in the user's shell configuration file The location of that
configuration file (e.g., $HOME/.cshrc, or $HOME/.profile) and the
exact syntax will obviously depend upon the shell used.
Or you could redefine the PATH variable of the user in question, so
that, for example, $HOME/bin precedes /usr/bin and /usr/local/bin, and
ln -s /usr/local/bin/gcc34 $HOME/bin/gcc
ln -s /usr/local/bin/gcc34 $HOME/bin/cc
ln -s /usr/local/bin/cpp34 $HOME/bin/cpp
and so on. Of course the aliases and links above are just typical
examples, and may not work in your specific case: you have to consult
the scripts in your MIPS tools in order to determine which values to
If your user still wants to have the flexibility of using the base
system compiler in some cases, without having to undo changes like
those above, and only wants to use gcc34 with the MIPS tools, you
could try using a per-directory environment change with the
I don't mean to be impolite, but I would have thought that someone who
will be doing cross-development for MIPS would have been able to
figure this out, or patch the toolchain scripts. Are you sure this
user is up to the task?
More information about the freebsd-questions