Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2010 10:57:16 -0500
From:      "b. f." <bf1783@googlemail.com>
To:        freebsd-questions@FreeBSD.org
Cc:        giorgosfm@yahoo.gr
Subject:   Re: How to use an older version of gcc?
Message-ID:  <d873d5be1001280757k2e153222t511d2862f9d4ccd7@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
gfot wrote:
...
>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
set

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

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
sysutils/penv port.

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?

Regards,
               b.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d873d5be1001280757k2e153222t511d2862f9d4ccd7>