FORTRAN on Mac OSX

Discussion in 'Mac Programming' started by carrollp, Dec 27, 2007.

  1. carrollp macrumors newbie

    Joined:
    Dec 27, 2007
    #1
    I have built a FORTRAN program on Mac OSX using GNU gcc and f77. Works fine, but when I try to run it on another OSX Mac, I get an error:

    dyld: Library not loaded: /usr/local/lib/libg2c.0.dylib

    Can't I build a program that is runnable on other OSX Mac's that doesn't have the compiler installed?
     
  2. eharley macrumors newbie

    Joined:
    Dec 27, 2007
    #2
    The problem is that all OS X systems come with the C runtime shared libraries installed by default, while they don't include the Fortran 77 runtimes by default. The Fortran libraries get installed when you install the compiler. If you want to distribute the program to a user who might not have the Fortran library you're using, then you need to statically link the runtime into your program. Try adding "-static-libgfortran" to your compiler directives.
     

Share This Page