SUMMARY: Multiple C compilers question

From: Alan Carbutt <arcarbut_at_adams.edu>
Date: Wed Jul 28 2004 - 10:56:01 EDT
Thanks to all who replied.  I was hoping that this was an easy fix or
that the solution was not too complicated.  Now I just need to figure
out the best way to implement it on our end.  Here's the original post:

Hi all,

I'm presented with the challenge (for lack of a better four letter word)
of having gcc and Forte run on the same machine.  Is this just something
as simple of having the path for each compiler under separate users?
What are some ways to approach this problem?  I will summarize.

Thanks,

*****************************************************************************
Here's the replies:

We have machines installed like that with no problems using the distribs
from sunfreeware.org, which install in /usr/local.  Then depending on
what we want to do... we set the path appropriately.

Renny Koshy
President & CEO
***

 There should be no problem whatsoever with having both compilers in the
 path. Path ordering may however affect which compiler is found and used
 by configure scripts. If necessary, a compiler can be forced:

$ env CC=gcc ./configure
or
$ CC=gcc ./configure

 depending on the type of shell.

 Another possible issue is whether or not GNU as/ld are installed.
 This shouldn't generally be necessary on Solaris, the commands in
 /usr/ccs/bin are prefered.

 -l
(Lars Hecking)
***

It's not even that complicated.  The Forte compiler is called cc,
and the GNU compiler is called gcc.  Invoking one will not invoke
the other.

I regularly build stuff on the same machine using both compilers.

HTH,

--
Rich Teer, SCNA, SCSA
***

Having those two compilers peacefully coexist is quite easy and very
common.  The developer will have to configure his/her environment to
choose which to use.  In most cases, it's simply a matter of having the
path of the preferred before the path of the secondary.

Gary Chambers
***
We are running with the exact same setup. Basically just set path for
one
or the other. Set path with /opt/SUNWspro/bin before /usr/local/bin if
you
want to use Forte, and /usr/local/bin before /optSUNWspro/bin if you
want
to use gcc. I will usually set the CC environment variable to either cc,
or
gcc as well. Have not seen any problems so far.
Gary P Carr
***

I may be missing the point but won't one of them be called as gcc
and the other as cc (or via the Forte gui)? I really don't recall
any issues with having both installed in a previous job.

--
John.
(John Leadeham)
***

It's actually pretty simple, we already do this.

Our default environment supports gcc, we have a global
/usr/local/etc/default.cshrc file which adjusts the path
to contain gcc (in our case /usr/local/bin).

If I want to use Forte I start with a clean environment
which does not include /usr/local/bin and then define CC
and add Forte to my path:

   set CC=/usr/local/ForteDeveloper_6.0/SUNWspro/bin/cc;
   set path = (/usr/local/ForteDeveloper_6.0/SUNWspro/bin $path)

That's pretty much it. Only drawback is if not having /usr/local/bin
in your path is a problem, in which case you'd want to install
gcc in /opt perhaps.

Dave Foster
***

Hi,
this is something we've been doing for years, but there's no conflict as
the compilers have different names.

compiler        C       C++     Fortran
Forte           cc      CC      f77
gnu             gcc     g++     g77

See, no problem. Just put both in the standard path.

(Christopher Dupre)
***

Install the two in different directories (default for Forte is
/opt/SUNWspro and /usr/local for GCC (if you use SunFreeware's
packages)) and you should be all set.

-Alex
(Alex Stade)
***

Yes it is possible.
Install gcc in /usr/local (which I think is the default location)
And Forte in /opt.
This works fine. I have forte 6 and sun Studio 7 on same system but
having different installation paths.

Regards,

Minoti Koul
***
I don't think that's a big deal. I have gcc 2.95 in /usr/local and
Forte 7.0 in another path (/blah02/app/SUNWspro) and I've never
encountered a conflict. I NFS export SUNWspro, too and no one has
complained.

Try it!
(JV)
***

On most gnu or free software, the configure script check for cc or gcc.
The first occurrence in the path wins.
I guess there is no problem using cc or gcc, perhaps can you create two
scripts that will set the
path and ld_library_path correctly, according to your needs. (one for cc
and one for gcc, or only one with cc or gcc as parameter).

Sometimes I used both cc and gcc to avoid compilation troubles.

NF
(Nicolas Figaro)
***
Alan,

we work with several versions of the two compiler suites. Our solution
is to have environment files for each version that are being sourced as
you choose one of them for your daily work. Within those env files, we
set PATH, MANPATH and - probably most important - LD_LIBRARY_PATH to the
respective ./lib directories. Of course sourcing MULTIPLE env files
causes massive trouble, but as long as you use only one environment its
all working fine.

HTH,

dd
(Daniel Dennes)
***

I would have thought you could have each compiler under separate areas
and users can set their path approriately. The only problem would be if
Forte picks up some gcc specific includes but it shouldn't.

You could try installing Forte, compiling gcc with it with configure
option --prefix=/opt/GCC or something like that.

Regards,
Chris
(Chris Pinnock)
***

I have something similar working now.  We have the Sun provided
compilers under /opt and the gcc compilers under /usr/local.

There are no symlinks calling gcc cc.

When something needs to be built using the Gnu tools I set
CC=/usr/local/bin/gcc etc.  For the Sun tools I use
CC=/opt/SUNWspro/SCx.y/bin where x.y is the version number of the
compiler to use.

Using make file templates simplifies this a lot.  We use templates for
gcc-2.8.1, gcc3.3.2, and 2 versions of the workshop compilers.  Under
Linux we do the same thing for 2 versions of gcc and the pgi compilers.

I hope this helps you.
(Rik Schneider)


--
Alan Carbutt
Systems Administrator/Programmer
Adams State College
719-587-7741
arcarbut@adams.edu

[demime 1.01b removed an attachment of type application/pgp-signature which had a name of signature.asc]
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Jul 28 10:55:55 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:36 EST