Static libgfortran on OS X

IainS developer@sandoe-acoustics.co.uk
Fri Dec 19 20:08:00 GMT 2008


On 19 Dec 2008, at 15:52, Thomas Blom wrote:

> Hi -- I've been reading this thread with interest, as I posted a  
> similar question a few weeks ago that received no response.  I'm  
> fairly new to osx/gfortran, so I'd like to ask, based on my  
> previous email (pasted below) -- is this thread addressing the same  
> problem as I asked about?

yes, I think so.

> mb13:/usr/local/lib thomas$ ls -al libgf*
> -rwxr-xr-x   1 root  staff  1795788 Dec 31  2006 libgfortran. 
> 2.0.0.dylib
> lrwxr-xr-x   1 root  staff       23 Aug  3  2007 libgfortran. 
> 2.dylib -> libgfortran.2.0.0.dylib
> -rwxr-xr-x   1 root  wheel  2062056 Aug 15  2007 libgfortran.3.dylib
> -rw-r--r--   1 root  wheel  2581788 Aug 15  2007 libgfortran.a
> lrwxrwxrwx   1 root  wheel       19 Aug 31  2007 libgfortran.dylib - 
> > libgfortran.3.dylib
> -rwxr-xr-x   1 root  wheel      966 Aug 15  2007 libgfortran.la
> mb13:/usr/local/lib thomas$ gfortran --version
> GNU Fortran (GCC) 4.3.0 20070810 (experimental)

I don't think there's any material difference to this problem on  
4.3.x vs. 4.4.0

Rename all instances of libgfortran.a to something else (say  
libgfortran-static.a) **remembering to ranlib the new copy.

then the following should work:

gfortran-4.3 -nodefaultlibs  <your objects, files, libs etc > -o  
<your output> -lgfortranbegin -lgfortran-static -lgcc_eh -lgcc -lSystem

alternatively .. I would expect this to work if you don't need static  
gcc (X = 4 or 5 depending on your system)

gfortran-4.3 -nodefaultlibs  <your objects, files, libs etc > -o  
<your output> -lgfortranbegin -lgfortran-static -lgcc_s.10.X -lgcc - 
lSystem

These are hand-typed lines, so beware typos (the principle should  
apply tho).

Iain



More information about the Fortran mailing list