Using Fortran Compiler

I've been having major problems using a Fortran compiler on my Powerbook G4. I have Tiger and xCode 2 installed, and I've downloaded g95 for Tiger and other compilers, but can't get the compiler command to work in my x11 window. The instructions that come with the compiler aren't helping at all. Does anyone have explicit instructions on how to add the Fortran compiler? I'd like to use it as I use gcc for my C files. Thanks.

Posted on Sep 12, 2005 7:51 PM

Reply
6 replies

Sep 13, 2005 7:54 PM in response to Alexander Sayers

Just a little warning that you may or may not need; my apologies if you don't.

I've been watching, on another list, a lot of discussion of various versions of fortran. A lot of people are getting burned by mismatching versions of gcc and g77, g95 or gfortran.

Also, as far as I can tell, neither g95 nor gfortran has passed beyond a rough beta stage. My information may be out of date, but if so, it was only recently that either of them (and I wouldn't know which) became sufficiently bug-free to actually use. Bill may have better information than I.

Use the gcc_select command to check or set your gcc version; use g95 or gfortran only in combination with gcc 4.x (that is, if you're building a app that uses both C and fortran).

Sep 14, 2005 6:51 AM in response to Alexander Sayers

At this point g95 has fewer bugs and complies more programs than Absoft 9.0 or any other fortran compiler that I know of. It compiles programs much slower, but they run only slightly slower. About, the only thing missing from g95 is CRAY pointers. gfortran compiles programs much faster then g95, but it still has many bugs. Still, if one of the ~300 known bugs in gfortran does not affect your programs, it is usable. By the way, a few years ago, one of the maintainers of the HP fortran compilers told me that their known bug count never gets much below 300 and jumps up much higher at each new release.

Dec 8, 2005 11:31 AM in response to tong

You can get standalone gfortran here:

http://gcc.gnu.org/wiki/GFortranBinaries#MacOS

gfortran 4.1 works fine with Xcode2.1 and 2.2 I've found it compiles most of my stuff but there are run-time errors in several programs.

gfortran, g77 and g95 are all available via fink. The gfortran in fink is older, and buggier, so if you want the most up to date version, grab my unofficial gcc4 fink debian packages here. You can grab my precompiled g77 there as well, if you have Xcode 2.1. If you have 2.2, you need to recompile it to get g77 to work right.

g77-3.4.x works fine with gcc4.x

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using Fortran Compiler

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.