Is -V still supported/sane/useful?

Joe Buck jbuck@synopsys.COM
Fri Feb 4 08:55:00 GMT 2000


> I've never seen -V used in discussions or recommendations on this list,
> so here goes.

> Here I use 2.95.2.  A fellow admin has 2.8.1, which they need to keep for
> some reason.  We need to synchronize versions.  Assuming that a 2.95.2
> installation uses the same --prefix as the 2.8.1 installation, what's the
> rule for getting them to live side-by-side?

I would recommend using different --prefix values rather than trying to
use -V.  But if you really want to, I would suggest keeping the drivers
from the newer version (the stuff that lives in $prefix/bin), and
then make a combined tree with gcc-lib/PLATFORM/2.8.1 and
gcc-lib/PLATFORM/2.95.2.  The default will then be to use 2.95.2,
and -V 2.8.1 will attempt to invoke the older compiler.

Doing a regular install first of the old compiler and then of the second
will approximate this, but you may have to do some by-hand fixing.
No warranties.  I have done this unintentionally many times (install
the new release with the same prefix, noticed that there are still
older compiler versions in their own PLATFORM/VERSION, even tried -V
a few times), but can't promise you that it will really work right.

> In theory (and in the gcc.info-4 file), I know that the -V option can be
> passed to the driver to override the default version.  But what about all
> the stuff that's outside of ..../gcc-lib/PLATFORM/VERSION?  If he installs
> the newer version on top of the older one, will critical stuff from 2.8.1
> be zapped?  What about vice versa?

If he's going to do a new installation, he should use a different prefix.
But since you really seem to want to use -V:

The biggest problem is with library stuff.  You can put version-specific
libraries in gcc-lib/PLATFORM/VERSION, so at least linking works right,
but you will have problems with the C++ headers, since you'll need
different headers for the two versions (there are some library changes).

> I've always just distrusted the -V documentation and given each version
> its own --prefix, but that's a worst case scenario here.

Your distrust is well-founded.  -V probably works OK if you're only doing
C, or are using compiler versions that are very close together (e.g.
snapshots for the same release), so that it doesn't matter that all the
versions will use the same headers and libraries.




More information about the Gcc mailing list