views:

575

answers:

1

I'd like to compile a fortran code with gfortran so that it will work on both Mac OS X 10.5 and 10.6. Is there a way to do this? I tried compiling on 10.6 and get this message when I run the executable on 10.5:

dyld: unknown required load command 0x80000022 Trace/BPT trap

A: 

What version of 10.5 are you on? According to this (0x22) is a dynamic load function that got added at 10.5.6. You could try upgrading to >10.5.6 and see if the problem persists.

Also where did you get your gfortran from? In the numpy community the ones from att.com are highly recommended and the builds from hpc are generally to be avoided.

thrope
I agree with the recommendation to avoid the compilers at HPC. Placing a non-Apple gcc in /usr/local is dangerous without giving the files different names. But the gfortran at att.com is version 4.2, which is obsolete. gfortran versions 4.3 and 4.4 are improved, and have additional language features. I suggest obtaining gfortran from MacPorts, which includes it in the gcc43 and gcc44 packages. More "cutting-edge": the latest version of 4.5 (beta) is available on the gfortran Wiki page.
M. S. B.
Thanks for the tips. Didn't realize hpc was to be avoided!Tried the 4.2 version from att and had this error:dyld: Library not loaded: /usr/local/lib/libgfortran.2.dylibAfter a bit of mucking around, I found that I could get my older compiler, ifort 11.0, to work with the flag -mmacosx-version-min=10.4. I tried the same with gfortran but still had the original error. Would be nice to get gfortran to produce a portable executable, but at least I can get ifort to do this for now.
kk
With ifort, the option "-static-intel" may help -- this will statically link the intel libraries into the executable, removing dependencies on intel provided dynamic libraries. But it won't solve any issues with non-intel dynamic libraries.
M. S. B.
@M.S.B. - I know att is a bit out of date but the macports ones generally don't have apple specific mods (-arch, -isysroot etc.). In any case snow leopard has only just using the same version (gcc 4.2) so I think calling it obsolete is a bit strong - things just move slower in apple world ;)
thrope
gfortran is different from the rest of gcc -- it started with version 4.0. 4.3 and 4.4 have many additional language features, such as the very useful ISO C binding.
M. S. B.