This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static libgfortran on OS X


On Thu, 18 Dec 2008, IainS wrote:

> 
> On 17 Dec 2008, at 15:15, Ray Nachlinger wrote:
> 
> >On Wed, 17 Dec 2008, IainS wrote:
> > >If that doesn't work, then I'm working on reissuing my patch to make static
> > >libgfortran work on darwin.... but it's not going to be for at least a few
> > >days.
> >
> >  Thanks, I will wait.
> 
> Hm. I think this going to take a little longer (some day-job stuff is
> demanding attention).
> 
> A work-around (I'm assuming you're prepared to build gcc, if you were going to
> try my patch... so...).
> 
> Apologies if any of the following is "teaching my grandmother"... and see also
> http://gcc.gnu.org/install/
> 
> 1/ build (or obtain) an up-to-date gcc, including fortran (current svn is
> building OK in my experience).
> [[ 1 (a) if you install using fink etc. you can still make the changes - but
> you'll have to find stuff relative to the /sw or /opt and sudo the mv/ranlib
> ]]
> 
> use (at least) [assuming you're building this to operate on Leopard] :
> --prefix=/somewhere/you/have/rights/to/install/to   (it's not necessary to use
> a privileged path).
> --enable-languages=c,fortran  (at least)
> --target=powerpc-apple-darwin9 --host=powerpc-apple-darwin9
> 
> I recommend:
> --enable-version-specific-runtime-libs --enable-checking=release
> --program-suffix=-4.4.0
> 
> I don't recommend:
> --with-slibdir= ... if you do use it ... be very careful NOT to overwrite
> anything in your /usr/lib directory  - you'll need to do a staged install.
> 
> 2/ once installed and assuming you used the options above...
> 
> cd /your/chosen/prefix/lib/gcc/i386-apple-darwin9/4.4.0
> mv libgfortran.a libgfortran-static.a
> ranlib libgfortran-static.a  (don't worry about the messages)
> mv libgomp.a libgomp-static.a
> ranlib libgomp-static.a (don't worry about the messages)
> cd x86_64
> mv libgfortran.a libgfortran-static.a
> ranlib libgfortran-static.a  (don't worry about the messages)
> mv libgomp.a libgomp-static.a
> ranlib libgomp-static.a (don't worry about the messages)
> 
> 3/  Note that -Bstatic didn't do anything on Apple's linker last time I
> checked... (although they hopefully will add it sometime)
> 
> to build a completely static executable:
> 
> /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
> 

  Thanks so much, I downloaded the snapshot of 2081010, built 
  it and the problem "went away"; i.e. I can now statically
  link libgfortran. 

  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?

  Again, thanks,

  Ray
  and it is in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]