Static libgfortran on OS X

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


On 19 Dec 2008, at 13:30, Ray Nachlinger wrote:
>   Thanks so much, I downloaded the snapshot of 2081010, built
>   it and the problem "went away"; i.e. I can now statically
>   link libgfortran.

I assume you're using the full path to the libraries - as you  
indicated in your original post.
(If you're just putting -static-libgfortran, then the executable is  
still linked to libgfortran.3.dylib - but it will, of course, work  
fine - so long as gfortran is installed on the machine you want to  
run it on.)

>   One more question. In my build, there are two files named
>   libgfortran.a, one in /prefix/lib and one in /prefix/lib/x86_64.
>   Are you simply telling me to rerun ranlib on the existing libraries?


If you want the option of an abbreviated command line as below:

> /your/chosen/prefix/bin/gfortran-4.4.0 -nodefaultlibs <all your  
> objects> -o
> <your output file> -lgfortranbegin -lgfortran-static [-lgomp- 
> static] -lgcc_eh
> -lgcc -lSystem

and you definitely need statically linked fortran and gcc then
you need to change libgfortran.a files to libgfortran-static.a and  
ranlib.

There are, indeed, two libs ; one for 32bit code and one for 64bit  
code.  The one in x86_64 will be used if you compile "-m64".

Iain



More information about the Fortran mailing list