fink-beginners  

Re: [Fink-beginners] gcc4.0 installed but is not installed

monipol
Sat, 14 Nov 2009 08:13:05 -0800

On 14/11/2009, at 05:37, Vadim Biktashev wrote:
> monipol wrote:
>>
>> On 13/11/2009, at 21:03, Vadim Biktashev wrote:
>>> a question from a newbie. My fink has an obsolete and incomplete
>>> (without
>>> gfortran) version of gcc installed, but I cannot remove it as fink
>>> denies it
>>> is installed:
>>>
>>> My attempts to update it were equally futile.
>> As explained above, gcc4.0 is a virtual package. It represents  
>> gcc-4.0
>> installed by Apple's Xcode which in fact hasn't got gfortran.
>
> Thanks for the explanation - but how does this help me with my  
> problem?
It should help you understand that both gcc-4.0 and gcc-4.2 are  
virtual packages that represent different versions of GCC that were  
*not* installed by Fink. See below.


> monipol wrote:
>>
>>> Installing a newer version of gcc (4.2) with gfortran on top of 4.0
>>> does not
>>> seem to help, as somehow the old one (4.0) takes precedence and
>>> reports that
>>> the gfortran does not exist, even though `which gfortran' shows it  
>>> in
>>> /sw/bin all right
>>
>> gcc4.2 is also a virtual package that represents gcc-4.2 installed by
>> Apple's Xcode.
>
> Well, with this one I know where it came from, I have installed it  
> myself
> using fink.
> Unlike 4.0 it is complete (i.e. includes fortran).

Not really, Vadim. gcc-4.2 is a virtual package that represents GCC  
version 4.2 located under /usr/bin, e.g. /usr/bin/gcc-4.2. Fink *does  
not install* gcc under /usr/bin. Usually /usr/bin/gcc-4.2 is installed  
by Xcode. It is also possible that you have manually installed GCC 4.2  
under /usr/bin.

Fink does have a set of packages for GCC. They're called gcc42, gcc43,  
and gcc44 (notice there's no dot between 4 and the last digit). The  
files installed by these packages are located under /sw/lib/gcc4.x. As  
they conflict themselves (although the -shlibs packges don't) you can  
have only one of them installed at any given time. Let's suppose you  
have gcc44 installed. You should have, then

/sw/bin/gcc-4 pointing to /sw/lib/gcc4.4/bin/gcc
/sw/bin/gfortran pointing to /sw/lib/gcc4.4/bin/gfortran

> monipol wrote:
>>
>> If you run
>>
>> fink list gcc
>>
>> you should be able to identify which gcc packages are virtual.
>>
>> As you've got gfortran under /sw/bin then you should have one of
>> Fink's gcc packages that provides it. The following command should
>> tell you which package installed that gfortran.
>>
>> dpkg -S /sw/bin/gfortran
>
> Yes, this does tell me that gfortran belongs to 4.2, but I knew that.
What is the *exact* output of the command above? It *cannot* be gcc4.2  
as this is a virtual package that represents a GCC installation under / 
usr/bin, not /sw/bin.

In what follows, I'm assuming that you have gcc42 installed (which is  
Fink's GCC 4.2 -- note there's no dot between 4 and 2). That means you  
should have both /sw/bin/gcc-4 and /sw/bin/gfortran on your system.

> My trouble is that I do not see how I can make 4.2 work instead of  
> 4.0: when
> I call gcc, it invokes 4.0.
> The thing is, I need to link together an executable made of C and  
> Fortran
> modules.
> Since calling gcc calls 4.0, it replies that fortran is not  
> installed, when
> actually it is .

You need to replace gcc by gcc-4 in your compilation. There are a  
number of ways to do this depending on what you use to build your  
program. You can manually run

gcc-4 program.c -o program ...

or, if you're using a Makefile, usually

CC=/sw/bin/gcc-4 make

does the trick.

> On the other computer, on which this code was developed, this problem
> somehow does not appear: that computer has both 4.0 and 4.3, 'which'  
> shows
> gcc is /usr/bin and gfortran is in /sw/bin/gfortran, similar to what  
> I have
> here, and somehow it all works together.

I'm not an expert with mixing C and Fortran so I'm afraid I can't help  
you with that.


Cheers,

--
monipol
http://finkers.wordpress.com

Submitting a Fink bug report? Read this:
http://www.finkproject.org/doc/netiquette/index.php
http://finkers.wordpress.com/2009/06/03/bug-reports/


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fink-beginners mailing list
Fink-beginners@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.beginners