Xcode/gFortran Plugin Update

A while back we introduced an Xcode/gFortran plugin and various installers that resulted from one of our contests. We've now updated the plugin to work with the latest gfortran from fellow MacResearcher Gaurav Khanna's site (August 2007 build). The installer includes:

* gFortran PPC (August 2007)
* gFortran Intel (August 2007)
* gFortran Plugin for Xcode
* Fortran Template for Xcode
* Updated Plugin Source

Note: The current plugin does NOT yet fix the ld flag passing bug.

August 2007 Build (59 MB Download)
March 2007 Build (52 MB Download)
January 2007 Build (52 MB Download)
October 2006 Build (49 MB Download)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thank you very much

I only want to thank to David all this work, and his help for helping me to install the gfortran plugin

Thank you David

Jesus Peinado

Uninstallation of ppc version of Gfortran from Intel Mac?

Is there an easy way to uninstall the ppc version of gfortran on an intel mac? The installer easy installs the ppc version by default. I did install the intel mac version afterwards as an option in the installer but I would like to remove the ppc stuff. Any easy way?
Thanks!
Bill Dailey

Uninstall ppc Gfortran

This question came up HERE. The punch line is that you remove some files in
/Library/Application Support/Apple/Developer Tools/File Templates
and
/Library/Application Support/Xcode/Plug-ins
I had to do this just a few days ago. I had better luck when I only asked the installer to add the intel gfortran and skip the ppc version.
If anyone who know the installer more intimately sees a problem here, please correct me.

Is the old installer (for

Is the old installer (for gfortran 4.2) still available? I just tried the 4.3 version and now I am having problems linking.

Thanks,

V. Gregory Weirs
Sandia National Laboratories

Re: Gfortran installer

Hi Gregory,

Are you having problems within Xcode or linking in general? I'll try and dig up the old installer, but I think I overwrote it on the server side. I can recreate the package if necessary though.

Let me know,

Dave

Re: Gfortran installer

Dave,

No, I am not using Xcode. The errors I get are that some symbols are defined multiple times, and it seems that some libraries don't have any symbols. I am compiling a number of libraries and then an application against them, and there is mixed C, C++, and legacy fortran. Possibly gfortran4.3 refuses to compile some old code that the earlier version accepted? Eventually I'll try to figure out exactly what went wrong, but at the moment I just need to build, and gfortran4.2 worked for me.

Thanks,
Greg

V. Gregory Weirs
Sandia National Laboratories

Re: Gfortran installer

Hi Greg,

I've uploaded another copy of the previous installer. You can download it here:

Complete Installer gFortran 4.2

Note, that you may need to do a custom install if you are on an Intel box.

Let me know if that works or not.

Dave

Re: Gfortran installer

Dave,

I tried the custom install but the intel version, Xcode plugin, and Xcode source files are greyed out and can't be selected.

Thanks,
Greg

V. Gregory Weirs
Sandia National Laboratories

Re: Gfortran installer

Hi Greg,

I'm not certain why that would be. One thing to try is to open:

/Libary/Receipts

and delete all of the package receipts starting with gfortran (there should be at least one named: gfortranINTEL.pkg).

Let me know if that works. If it doesn't I'll post the individual package.

Regards,

Dave

BTW, the installer that I posted above, is the identical one that I removed earlier, so it should behave the same as the previous one. But there may be a conflict in what the system thinks is installed and what really is (that is, it won't let you "upgrade" to a lower version of the package).

Re: Gfortran installer

Hi Dave,

That did the trick. I did notice when I installed the 4.3 version for the first time that it said "upgrade" rather than "install", and was wondering how it tracked that.

Thanks for all your help!

V. Gregory Weirs
Sandia National Laboratories

Gfortran installer

As a follow up, I haven't found any problems in the 4.3 version that I didn't have in the 4.2 version. It turns out I had changed more than just the compiler when I tried to rebuild. Sorry about that.

With that said, I think its a good idea to keep old distributions around for a little while after new ones are released.

Greg

V. Gregory Weirs
Sandia National Laboratories

Where are Source Files Installed?

G'day,

I installed the complete installer package incluing the source files/project for the plugin. Where do the project/source files get installed? I have a receipt for the install in the usual place, but can't find the installed files anywhere!

Thanks,

Paul.

Re: Where are Source Files Installed?

Hi Paul,

There is a post-flight script that is supposed to move them from /tmp to $HOME, although it may not be working properly, so I'd check in /tmp. If you look in /tmp and don't see them there (say you rebooted since you ran the installer), you can re-run the source installer, by opening the meta-package.

Right click on the meta-package and choose show contents, within one of the folders should be the individual package files.

Regards,

Dave

Thanks

They were indeed in the tmp folder. spotlight or the finder search do not look there! Thanks for the tip. Wierd that it didn't copy to my home directory. Cheers, Paul.

GFortran installer

Hello,

I've just switched to using a Mac, and I'm having some trouble getting gfortran to work. I've downloaded and run the installer, but when I open a terminal and try out gfortran, I get an error saying the command gfortran is not found. Is there some additional step I need to take to make gfortran usable?

Thanks,
Ventres

look at path

I had a similar problem. It may help to look at hpc.sourceforge.net. In particular you may need to give terminal the path to gfortran.

"Note: Tiger/Panther does not include /usr/local/bin in its default PATH. Therefore, assuming you're using the default bash shell, please type (or include in /etc/profile) PATH=/usr/local/bin:$PATH and export PATH before using any of these tools."

Like I said, that helped me. I hope it solves your problem as well.
JM

can't find Xcode

I just downloaded and installed the Xcode/gFortran using the plugin. It seemed to install OK but I can't find the Xcode program. Where did it go?

Also, are there some fortran example files somewhere that I can look at? It has been a while.

Thanks

XCode

It can be downloaded from the Apple site (http://developer.apple.com/) free registration required.

Linking

I seems the gFortran Xcode plugin is causing anything listed in the "Other Linker Flags" to be ignored when any Fortran source is included in a project. I have a mixed project (Obj-C and Fortran) and I had -framework Foundation in the "Other Linker Flags". If I include any Fortran source in the project it causes the Foundation framework to not be linked.

I can get around it by dragging the Foundation framework into the Target folder, but this shouldn't be necessary.

Can anyone share exactly what compiler/linker settings get diddled by the gFortran plugin?

Thanks.

Eric

Same problem

I can confirm that I've seen the same thing happening. Drove me crazy for a little while trying to figure it out. I couldn't find a work-around for what I was trying to do. I'd be curious what others have done, or if there is a way to fix this. I'm using an intel mac, but I've seen it happen on a PPC as well.

Re: Same problem

I'm working on the source for the plugin right now. So if someone can give me a simple set of steps to reproduce the problem. I can investigate it and hopefully come up with a solution.

Thanks,

Dave

reproduce the problem

This is what I did:

*Created a basic C project ('standard tool')
*added this to the 'main' function:

void forty_();

printf("Hello, World!\n");

forty_();

*Created a file named forty.for containing (my file had the requisite beginning spaces):

subroutine forty
print*,'hello nurse!'
return
end

*Added the file to the project
*Compile and run, it should work

Now try and add any random nonsense flag to the 'other linker flags' field, and it should give an error, but it doesn't. Nothing in that field will pass to the linker, as can be seen by looking at the output of the build script.

help for a newbie...

Hi, having always had computing support at Grad school, I'm now a post-doc an required to maintain my own computer for the first time - and I'm totally clueless. I'm running a new MacBook, I've installed Xcode and the Developer package, but I still need a Fortran compiler.

gFortran seems to have installed fine, but when I run it I get the following message:

/usr/bin/ld: can't locate file for: -lcrt1.o
collect2: ld returned 1 exit status

This means nothing to me, so I have idea how to fix it. Can someone help?

Thanks,
Annabel

Re: help for a newbie

Hi Annabel,

On my system the file is located at:

/usr/lib/crt1.o

This is with Xcode 2.4.something. Although I'm pretty sure this is a system object file and not part of gfortran itself. Do you have a similar file?

When you installed Xcode, did it install gcc?

Dave

It had installed gcc, but I

It had installed gcc, but I was only us Xcode 2.1. I've updated to 2.4 and now everything works. Thanks!

Annabel

Dave, any luck fixing this

Dave, any luck fixing this yet?

Eric

Re: Dave, any luck fixing this

Hi Eric,

Not yet. We did talk about this with Apple last week at the Tri-Cam and hopefully I'll have this issue fixed in the very near future.

Thanks,

Dave

Page not found?

When I click on the download link for the March 2007 build, I just get a "Page not found" error. Anybody else having similar problems?
Thanks!

Re: Page not found?

Fixed. I typed the link in wrong. Sorry.

Dave

gfortran and XLF

Hi-

Installing the gFORTRAN plugin for XCode seems to have disrupted the xlf plugin. Since I installed it, building any target which uses xlf produces

Building target “XNet_Setup” of project “XNet” with configuration “Deployment” — (1 error)
Checking Dependencies
Internal error occurred while creating dependency graph: *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value
Build failed (1 error)

If I change the compiler for this target to gfortran, it works.

If I remove the gfortran plugin, xlf works. Can anyone report if a similar problem occurs with ifort and gfortran?

It be nice if both both compilers could be used within XCode.

Raph

Re: gfortran and XLF

Hi Raph,

The gfortran plugin and XLF (and ifort) are mutually exclusive. This is because in the current implementation of the plugin gfortran overrides the default fortran settings within Xcode and therefore becomes the default compiler. This plugin was NEVER intended to work side by side with any other fortran compiler. It was developed for those who want to use fortran within Xcode without having to buy a third party compiler.

Hope that helps clarify what you are seeing.

Dave

Xcode/gFortran Plugin

I switched recently to the Mac and wanted to have a fortran
compiler on my iBook G4 running Mac OS X, version 10.4.
I downloaded the October 2006 Build installer for gFortran
(I had difficulty in unpackaging the later ones). I successfully
installed everything, but I'm now not able to compile anything.
When I attempt to compile a code in the default bash shell,
I get an error message

/usr/bin/ld: unknown flag: -macosx_version_min
collect2: ld returned 1 exit status

Can anyone help with this? I'm not terribly computer-literate,
so any simple-minded tips will help.

I also have not figured out how to run gFortran from Xcode. Perhaps
I need a later version (since I'm currently using version 2.0)

Sorry for the lowbrow questions, but I'll be grateful for any help.

Thanks! -- G Eyink

Re: Xcode/gFortran Plugin

Hi,

You need Xcode 2.4 or higher for the plugin to work.

Thanks,

Dave

Re: Xcode/gFortran Plugin

Dear Dave,

Thanks a lot! I downloaded and installed Xcode 2.4.1 and this got me quite a bit further. The gFortran compiler now works when I run it using the default bash shell.

However, I still seem to have problems in Xcode. After following the instructions from the URL

http://www.macresearch.org/xcode_gfortran_contest_winner_damien_bobillot

about using the plugin, my fortran run log reads as follows:

Hello, World!
ZeroLink: unknown symbol '__gfortran_st_write'
fortran has exited due to signal 6 (SIGABRT).

Any more words of wisdom for the neophyte?

Best - G Eyink

gfortran

I installed gfortran a few minutes ago. I tried to compile a file and got the following message:

[Bob-Silbeys-Computer:~/Desktop] bobsilbe% gfortran 'fln.f'
gfortran: error trying to exec 'as': execvp: No such file or directory

Any idea what's wrong?
Thanks

gfortran

I installed gfortran a few minutes ago. I tried to compile a file and got the following message:

[Bob-Silbeys-Computer:~/Desktop] bobsilbe% gfortran 'fln.f'
gfortran: error trying to exec 'as': execvp: No such file or directory

Any idea what's wrong?
Thanks

Re: gfortran

Hi,

'as' is the assembler. If you get his error it means you don't have the base compiler tools installed. I use Apple's compiler for all my work, so that gets installed when Xcode is installed. I'd recommend installing Xcode (or at least download Apple's Xcode package and install the gcc subcomponent). That will clear up this error for certain.

Regards,

Dave

linking with gfortran

Hello,

I just installed gfortran and the Xcode plugin (August 2007 build), and after adding /usr/local/bin to the PATH I can compile from the command line, but when I try to link I get the following error:
/usr/bin/ld: warning can't open dynamic library: /libgcc_s.1.dylib referenced from: /usr/local/lib/gcc/i386-apple-darwin8.10.1/4.3.0/../../../libgfortran.dylib
The library libgcc_s.1.dylib exists in /usr/local/lib, but obviously not in /
How can I tell the linker to look in the correct lib directory?

thanks,
Teddy

ld flag passing bug.

I would like more information about this. It seems to be one of the only issues we have using gfortran with our current build system (autotools).

Re: linking with gfortran

Hi Teddy,

This is indeed a bug. But it shouldn't be a terminal ug (that is, you should still get a binary out on the other side). Is that not what you are seeing? Gaurav is looking into this more closely to see if he fix the problem. But if it's just coming up as a warning and producing the executable, you should be OK.

Regards,

Dave

Hi Dave, Well, indeed, there

Hi Dave,

Well, indeed, there was a perfectly functional executable after the linking!

Thank you very much,
Teddy

linking with gfortran results in error

Hi Dave,

I get the same message as Teddy, but in my case the linking quits with an error:

/usr/bin/ld: warning can't open dynamic library: /libgcc_s.1.dylib referenced from: /Users/fk/usr/local/lib/libgfortran.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: Undefined symbols:
vtable for __cxxabiv1::__si_class_type_info
___cxa_pure_virtual
___gxx_personality_v0
std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream >&))
std::basic_ostream >::operator<<(int)
std::ios_base::Init::Init()
std::ios_base::Init::~Init()
std::cout

.....

vtable for __cxxabiv1::__vmi_class_type_info
___cxa_begin_catch
___cxa_end_catch
___cxa_rethrow
___cxa_call_unexpected
collect2: ld returned 1 exit status
make: *** [myprogram] Error 1

Is there a way around that or a bugfix? (I have to link with a fortran compiler and I don't have a commercial one.)

Thanks,

Fred

Re: linking with gfortran results in error

Hi Fred,

You may be able to get around this by adding an explicit link line to the specified library:

-L/path/to/libgcc -gcc_s.1

Or something like that. That way you'll get the library explicitly placed. You could also try perhaps setting the DYLD_LIBRARY_PATH to point to the location of the libgcc_s.1.dylib library file.

I think Gaurav is still looking into the problem for the compiler.

Dave

libgcc_s.1.dylib problem

The solution (until there are updated packages) is to use the install_name_tool:

sudo install_name_tool -change /libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylib /usr/local/lib/libgfortran.dylib

Change paths as appropriate. The syntax is install_name_tool -change old new library where old and new are the paths of the embedded path (i.e., libgcc_s.1.dylib) and library is the file you want to fix.

I can't guarantee this fixes all your linking problems.

gfortran linking problem persists ...

Hi Dave,

I had the directory in the DYLD_LIBRARY_PATH and even when explicitly linking libgcc_s.1.dylib as you suggested, the error persists.

Fred

Re: libgcc_s.1.dylib

Hi all

The missing /libgcc_s.1.dylib is a bug in gfortran. However, this missing library does not cause an error in the compilation. It is simply a warning. As Dave pointed out, the compilation should be successful and you should get a binary at the end of the day. It is "safe" to ignore this warning.

If that is not happening, please report back here. In that case, you are likely having a different issue with the new gfortran build. I hope this helps some of you a little bit.

Gaurav

I think here, there is

I think here, there is something else going wrong, Fred. Also I noticed that you appear to have gfortran installed in your own directory? That is not appropriate. gfortran needs to be installed in /usr/local. Please reinstall gfortran using the installer package. That may take care of this error for you.

libgcc_s.1.dylib

HI,
I have recently installed gfortran in my MacBook intel based.
I have been able to compile very simple codes, but when I try to compile the important code for me, which contains some Fourier Transforms, I get the following message:

Warning: Extension: REAL array index at (1)
/usr/bin/ld: warning can't open dynamic library: /libgcc_s.1.dylib referenced from: /usr/local/gfortran/lib/gcc/i386-apple-darwin8.10.1/4.3.0/../../../libgfortran.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: Undefined symbols:
_dfftcb_
_dfftcf_
collect2: ld returned 1 exit status

So it looks to me that due to the fact that it cannot open the Dynamic Library, it is not able to recognise the Fourier Transforms; dfftcb, and dfftcf.

Could anybody help me with this? My research depends on this code!
Thanks

I don't think FFT is

I don't think FFT is included in any gfortran library. Are you doing something differently? Do you have FFTW installed, or do you use vecLib?

FFt

Hello,

No idea. The thing is that my code was compiled with VISUAL FORTRAN COMPILER, in Windows. So I was using the library IMSLF90 and everything was fine.
Since I had to move everything to my Laptop (Mac), it does not work anymore.
My question then is, what should I do to make it work in Mac with the gfortran compiler?

THanks.