could Xcode compile fortran files naturely?
By shrine08 at Sat, Apr 4 2009 3:31am |
I am new to mac. I want to program by Fortran. I installed Xcode3.1 and found that it can't compile fortran file.
Need I install gfortran into xcode?and how?(I've download gfortran files)




Up to now Xcode is not a
Up to now Xcode is not a great tool to develop Fortan codes.
The best compiler integrated to Xcode is iFort by Intel. The lattest version can be easily integrated in Xcode (A documentation provided by Intel explains how to do it). This permits to develop thanks to Xcode editor and to compile.
Unfortunatly,
- Fortran syntax is still not fully recognized. (For example there is no way to recognize DO loops or IF tests and collapse them as for other langages with Xcode as C, java, ...)
- idb, the Intel debugguer is still not compatible by Xcode and Xcode cannot be used to debug Fortran code. Intel is working on the subject.
As far as I am concerned :
- I am using Xcode to develop fortran code because of the nice interface to manipulate complex codes
- I am compiling in command line
- I debug with other tools.
Regards
Alef
Xcode as debugger
Hi Alef,
"- idb, the Intel debugguer is still not compatible by Xcode and Xcode cannot be used to debug Fortran code. Intel is working on the subject."
I'm not certain wat you mean by Xcode cannot be used to debug fortran code. I do this all of the time, including using the graphical debugger to step through code via breakpoints, inspect variables and look at the assembly. As long as it's part of an Xcode project, it should work for ifort generated code.
You are correct that Xcode doesn't support things like code folding for fortran code. That would be a nice addition.
Regards,
Dave
Dear Dave
I am happy to learn that it is possible to debug fortran code thanks to Xcode. I never succeeded to make this work on my code. Do you succeed to access global variables ? If yes which compiler / debugger do you use ?
By the way do you succeed to use Instruments and Shark (with source code) on it ?
Regards
Alef
Re: Xcode and fortran
Hi Alef,
I haven't looked at globals, but I can check later and see if they too show up or not. I'm using icc/ifort with GDB within Xcode.
Currently Shark does not read fortran debug symbols generated from ifort (I'm not sure why). icc debug symbols do show up.
Regards,
Dave
Hi Dave,
Hi Dave,
I am trying to run and debug Fortran programs on Xcode, what should I do??, I am using gcc/gfortran because I can't find a free icc/ifort compilers for Mac...
Is there any guide or something??
Thank you.
Vincent
same problems
Hi together,
I have a similar problem. I followed the discussion about the Fortran plugins for 2.4 and 3.0 on mac research, and installed also the gfortran plugin (http://maxao.free.fr/xcode-fortran-plugin/), however I never managed to come to the point of debugging the program with breakpoints etc or make the "build and go" action to work. I am using xcode 3.1.2 and the latest gfortran compilers.
I also followed an older tutorial: http://lists.apple.com/archives/Fortran-dev/2006/Mar/msg00011.html however still no luck.
I manage to use the terminal to compile and run the program just fine, however I have no clue how to debug there or how to step by step follow the programs behaviour. (is that possible using the terminal)
Therefore I wanted to join in Vincents question for an (understandable) guide or tutorial on how use gfortran in xcode 3.
Any help would be really appreciated,
best,
Jan
I second (third, ..) that.
I second (third, ..) that. Any suggestions on how to debug (or even study performance issues) from within xcode with the intel fortran compilers would be greatly appreciated! I can edit, build etc a fairly complicated code within XCode using a makefile as external target. But I cannot find useful information on how to use breakpoints etc.
Even worse in my case. I
Even worse in my case.
I have a XCode 3.2.3 installation which doesn't support any Intel's Fortran compiler. It seems that IDE developers are trying to definitely kill Fortran language (or forgetting it...).
It's quite easy to find a decent free IDE for C/C++ development. However, the best option for Fortran developers is (still) MS Visual Studio with Intel compilers (not free though...).
In my case, I already tried Netbeans, Eclipse/Photran as well as XCode but all of these IDE's do not *FULLY* support Fortran language. Debugging is almost impossible at the level that VS2008 reaches.
Other (expensive) options would be TotalView or ABSoft debuggers.
Hey IDE developers, Fortran is still alive!
Hey everyone ! I stuck in
Hey everyone !
I stuck in the same position : unable to compile any fortan in Xcode (even from C).
I have followed many posts about FortanPlugIn (XCode 2.4, 3.0, 3.1 ...) in this forum
I have been trying for days to compile very simple code in fortran from C ...
My config :
XCode3.2.3
gfortran-42-5664.pkg from http://r.research.att.com/tools/
libgfortran-4.2.4-5646 (dynamic lib) from http://r.research.att.com/tools/
latest "FortranPlugin.pbplugin" in /Developer/Library/Xcode/Plug-ins
latest "Fortran File.pbfiletemplate" in /Developer/Library/Xcode/File\ Templates/Fortran
What I have tried :
main.c
#includeint main (int argc, const char * argv[]) {
// insert code here...
printf("Hello, World from MAIN.C!\n");
test_();
return 0;
}
Fortran.f95
subroutine testprint *,"Hello World from FORTRAN!"
end
XCode error:
"_test_", referenced from:_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I have the same error when I try to add "-lgfortran -lgfortranbegin" in "Other Test Flag" and "/usr/local/lib/" in "Library Search Fields" in my target file information ...
Terminal error :
MacBook-Pro-de-Mac-PNT:Fortran macpnt$ gcc -c main.c
MacBook-Pro-de-Mac-PNT:Fortran macpnt$ gfortran -c Fortran.f95
MacBook-Pro-de-Mac-PNT:Fortran macpnt$ gcc -o test Fortran.o main.o -lgcc_s.1
Undefined symbols:
"__gfortran_st_write_done", referenced from:
_test_ in Fortran.o
"__gfortran_transfer_character", referenced from:
_test_ in Fortran.o
"__gfortran_st_write", referenced from:
_test_ in Fortran.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I don't see what I am doing wrong ... has anyone found a working HowTo to compile fortran from C ? or can anyone help me to debug this ?
Or Can you share your working configuration (XCode, fortran compiler ...) ?
Thanks !