Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Need help to Run a Fortran project with Xcode 4.6. I have been compiling and executing Fortran code with "gcc-42-5666.3-darwin11.pkg" in /usr/bin on OS X 10.8 ML first. Then I downloaded Xcode with command-line tools, dev library and core library. Thx

I have been able to compile and execute Fortran code on OS X 10.8.2 with "gcc-42-5666.3-darwin11.pkg" downloaded to usr/bin. I use the command gfortran-4.2 -o to generate executable file.


I would like to Run a Fortran project with Xcode 4.6. So I downloaded Xcode with command-line tools, developer library and core library. Xcode Runs C code from the interface no problem, but I can not get a Fortran project to Run in Xcode interface. Seems that code never meets the compiler.


I installed Xcode two days after gcc-4.2 package. There is no /usr/local/bin on my hard drive, so no files there. If you can advise, I will be grateful.

Xcode 4.6-OTHER, OS X Mountain Lion (10.8.2), C code "Runs" on Xcode, not Fortran

Posted on Feb 1, 2013 11:19 AM

Reply
3 replies

Feb 4, 2013 10:24 AM in response to jforemski

I'm getting some FORTRAN dusted off after a couple of years and have been installing and getting it working as well. Slightly different order and I used the gfortran-4.2.3.dmg package. Things have changed in Xcode (improved I think) for handling FORTRAN since I worked on this code last time.


I do have /usr/local/bin but I'm not sure if that came with Postgresql, Macports or somethign else. gfortran does seem to have installed into /usr/local/bin with gfortran-4.2 in /usr/bin.


What have you got in your build rules? Is there some confusion in the rules about the installation?

Feb 4, 2013 6:48 PM in response to geogaffer

Hi,

First off, I am not a software developer or engineer, but I do occassionally use Fortran programs at work. I thought it would be good to learn about Xcode and use Fortran at the same time. Not so simple. Code in C would have been easier. None the less, I am cobbling together a system that will eventually work.


You can look at the pre-built Fortran package that I downloaded here: http://r.research.att.com/tools/. Apple may have the same at: http://www.opensource.apple.com/release/developer-tools-40/. Code compiles and programs run fine from the command-line interface in the Terminal window. I could just be satisfied with this, but next steps to do this with Xcode might not be too hard.


I am learning about writing/using Makefiles and telling Xcode to build/run my Fortran projects with Makefile. Here is where I am getting tips from: https://www.sharcnet.ca/help/index.php/Make_utility_and_makefiles. Also from here: http://meandmark.com/blog/2011/10/using-makefiles-in-xcode-4/.


Since the command-line is working just fine for me now, and this is not a high priority for me, I have not gone any further with the effort yet.


I have checked with folks that NEED Fortran to compile code on their OS X 10.8 systems and they all have told me the compiler with "gc-42-5666.3-darwin.pkg" always works.


Thank you,

jforemski

Feb 4, 2013 7:40 PM in response to jforemski

jforemski wrote:


I thought it would be good to learn about Xcode and use Fortran at the same time. Not so simple. Code in C would have been easier.


I certainly agree with that! Sounds like we are in the same boat. I have some geochem code that came in Fortran I need to dust off.



jforemski wrote:


You can look at the pre-built Fortran package that I downloaded here: http://r.research.att.com/tools/. Apple may have the same at: http://www.opensource.apple.com/release/developer-tools-40/.


The compiler with the R tools is familiar. I currently have the one from the HPC Mac OS X Project http://hpc.sourceforge.net but I remember reading some warnings that it did not work with R. I'm not building R so I went with a newer version.


jforemski wrote:


I am learning about writing/using Makefiles and telling Xcode to build/run my Fortran projects with Makefile.

Thats how I had it working a couple of years ago, and it worked quite well that way. I'm now trying to do more completely in xcode and possible xcodebuild. I can post what I get working here - it would be interesting to compare make with xcodebuild approaches and see what (if any) pros and cons there are.


Good luck.

Need help to Run a Fortran project with Xcode 4.6. I have been compiling and executing Fortran code with "gcc-42-5666.3-darwin11.pkg" in /usr/bin on OS X 10.8 ML first. Then I downloaded Xcode with command-line tools, dev library and core library. Thx

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