FORTRAN for Snow Leopard?

Jason Swails jason.swails at gmail.com
Sun Jan 9 11:34:45 PST 2011


On Sun, Jan 9, 2011 at 2:00 PM, Marcelo Chiapparini <
marcelo.chiapparini at gmail.com> wrote:

> Hi!
>
> after installing gcc_select, and before installing any gcc form macports, I
> ran it and got the following output:
>
> $ gcc_select -l
> Available versions:
> gcc40 gcc42 llvm-gcc42
>
> My guess is that gcc40 came installed with Snow Leopard by default, and
> gcc42 was installed by the latest version of Xcode I installed to run
> macports. Now I will install gcc45 or gcc46+gfrotan in order to run frotran.
> My question is the following: each time I need to install a port from
> macports, where Xcode is used, I should switch gcc to gcc42, the one
> installed with Xcode?
>

The ports *should* automatically use /usr/bin/gcc-4.2 to avoid this issue
altogether, and in my experience this is almost always the case.  The
notable exception for me has been with git-core.  In my opinion, you should
switch back to gcc42 if you can remember (all it does is shuffle around
symlinks, so it's cheap and easy), but it'll probably be fine if you don't.

One other comment -- if you're using gcc46 +gfortran, take care to spell
gfortran correctly, since port will not complain about misspellings and
silently ignore it.

Good luck!
Jason


>
> thanks in advance
>
> Marcelo
>
>
>
>
> 2011/1/7 Jason Swails <jason.swails at gmail.com>
>
>> Hello,
>>
>>
>> I use Fortran extensively on my Mac for my work (scientific computing --
>> all applications are written in Fortran).  I have tried both of the methods
>> that you have below, but I've had problems with all of them.  The problem
>> with installing just gfortran through binaries is that they're typically
>> incompatible with the Xcode GCC compiler (they're different versions of
>> GCC), so it's far more difficult to link C- and Fortran- object files.  If
>> you do find one that's compatible with the Xcode GCC, then that means you're
>> using GCC 4.2, which is quite old. gfortran from that era is not yet stable
>> and reliable, especially for legacy F77.
>>
>> IMO, the best approach is actually provided by MacPorts.  Just install an
>> updated GCC with the +gfortran variant.
>>
>> sudo port -v install gcc45 +gfortran (this may take a little while)
>>
>> Then you can install gcc_select to help manage different versions of the
>> GCC compiler (i.e. the xcode version and the MacPorts version, or multiple
>> MacPorts versions if you install gcc44, gcc43, gcc46, etc.)
>>
>> sudo port -v install gcc_select (this should be fast)
>>
>> To use gcc_select, do the following
>>
>> gcc_select -l (lists all of the available versions)
>> sudo gcc_select mp-gcc45 (selects the GCC 4.5 installed with MacPorts)
>>
>> Hope this helps,
>> Jason
>>
>> On Fri, Jan 7, 2011 at 8:49 AM, Marcelo Chiapparini <
>> marcelo.chiapparini at gmail.com> wrote:
>>
>>> Hi!
>>>
>>> I need to run FORTRAN in my iMac with OSX 10.6 installed. I've done some
>>> research, but the results are not conclusive:
>>>
>>> http://www.webmo.net/support/fortran_osx.html
>>> http://hpc.sourceforge.net/
>>> http://gcc.gnu.org/wiki/GFortranBinaries
>>> http://r.research.att.com/tools/
>>>
>>> I am not sure which method is the most convenient: to installing the
>>> FORTRAN binaries for Leopard or to installing the gfortran extension for
>>> Xcode... So, I would like very much to know about experiences from people
>>> already running FORTRAN in a Mac (if any!). Thanks a lot in advance for the
>>> help!
>>>
>>> Regards
>>>
>>> Marcelo
>>>
>>>
>>>
>>> _______________________________________________
>>> macports-users mailing list
>>> macports-users at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users
>>>
>>>
>>
>>
>> --
>> Jason M. Swails
>> Quantum Theory Project,
>> University of Florida
>> Ph.D. Graduate Student
>> 352-392-4032
>>
>
>
>
> --
> Marcelo Chiapparini
> http://sites.google.com/site/marcelochiapparini
>
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users
>
>


-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Graduate Student
352-392-4032
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20110109/7cb703a4/attachment.html>


More information about the macports-users mailing list