This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: gfortran on macs
- From: Brooks Moses <bmoses at stanford dot edu>
- To: Brian Barnes <bcbarnes at artsci dot wustl dot edu>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 23 Jul 2007 15:08:33 -0700
- Subject: Re: gfortran on macs
Hello, Brian!
I've cc'ed this to the fortran@gcc.gnu.org mailing list, which is the
official mailing list for GFortran; they may have more ideas than I do on
this, and will definitely know more about the binary packages.
At 08:44 AM 7/23/2007, Brian Barnes wrote:
Just this week I received my first Apple machine, a new Intel MacBook Pro.
By default XCode does not install fortran compilers, and the GCC version
installed is 4.0. I saw that the gfortran developers conveniently provide
a GFortran 4.3 binary package for download. Is it safe to use that
package when the version of GCC on the system (and presumably the
libraries) is 4.0? I am using OS X 10.4.10 and XCode that came on the
10.4.9 discs. I'm mailing you in particular because I have seen you post
about ppc/intel darwin machines and gfortran before.
I just want to get a fortran compiler on this system, and the alternatives
right now seem to be manually building all of GCC 4.2.1 from source, or
using your package. I'm kinda new to OS X -- with linux I'd know exactly
what to do. I also have fink installed, and in fink-unstable, I could get
the 4.1 GCC suite automatically compiled from source (I think). But I
know gfortran 4.2 and 4.3 are supposed to be much better.
I believe that using the GFortran 4.3 binary package should work fine with
a system GCC of version 4.0 -- the GFortran package should be set up so as
not to interfere with the system library at all. But that's an educated
guess; I haven't actually used the binary installer; hopefully the person
who makes it can comment to confirm this.
I found it almost trivially simple to compile things from source, much like
it would be on a Linux machine (and the commands are identical, too.) The
steps amounted to this:
* Download the source packages for the latest versions of the GMP and MPFR
math libraries, and unzip them.
* For each of the math libraries, cc into the source directory, do
"./configure", "make" and "make check", and then "su" and "make
install". This puts them in the /usr/local/lib directory, which is a fine
place for them.
* Download the source for the relevant version of GCC, unzip it, and build
as per the directions:
* Make an empty build directory.
* Run "configure" in the build directory with the appropriate options.
The ones I used are "../<sourcedir>/configure --prefix=<installdir>
--enable-languages=c,c++,fortran", for appropriate values of
<sourcedir> and <installdir>.
* Run "make" in the build directory.
* Wait about four hours.
* Run "make install". If <installdir> is /usr/local/bin, then you'll
need to do this after doing "su". Personally, I tend to install to
a directory in my home directory, for simplicity.
I think (but I'm not sure) that you'll need to install GMP and MPFR in
order to use the binary package, as well. I don't know the download links
offhand, but Google will find them easily.
(Oh, on second thought -- I think there was some trick on OS/X to enabling
"su" and a root password, but I don't remember what it was; it's probably
somewhere in the system dialog boxes. Doing "sudo make install" should
work instead; that just requires entering the password of the current user,
if you're logged in as a user with sufficient administrator privileges.)
Hope this helps,
- Brooks