This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC, Patch, gfortran] make -static-libgfortran work on darwin.
- From: FX <fxcoudert at gmail dot com>
- To: IainS <developer at sandoe-acoustics dot co dot uk>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 10 Jun 2008 17:11:53 +0100
- Subject: Re: [RFC, Patch, gfortran] make -static-libgfortran work on darwin.
- References: <A6664290-AFD1-4FCE-97E5-01DE56BB8B1D@sandoe-acoustics.co.uk>
The solution is to name the libs differently (as is done elsewhere
in gcc).
Target libraries named differently? Which? libssp has three variants,
which I don't really understand :)
$ ls libssp*
libssp.0.dylib libssp.dylib libssp_nonshared.a
libssp.a libssp.la libssp_nonshared.la
libgomp has shared and static libraries with the same name:
$ ls libgomp.*
libgomp.1.dylib libgomp.a libgomp.dylib libgomp.la
libgomp.spec
Only libstdc++ has the naming patter you mention, as far as I can tell:
$ ls libstdc++*
libstdc++-static.a libstdc++.6.0.4.dylib libstdc++.6.dylib
I opted to call the static library "libgfortran_static" and to
leave the shared name unchanged.
I'd suggest "-static" instead of using an underscore, to follow
libstdc++, but that's a minor point.
But more fundamentally, what is the reason that the linker can't be
persuaded to link a static library instead of a shared one? The
reason for that is that for darwin hosts, HAVE_LD_STATIC_DYNAMIC is
not defined. The description for that macro is "Define if your linker
supports -Bstatic/-Bdynamic option.". So, is there a way Darwin way
to achieve the same goal (according to my googling, there isn't, but
I might have missed something).
Otherwise, wrt your patch: doesn't it create three libraries:
libgfortran.dylib, libgfortran.a and libgfortran_static.a? And, what
happens now if you do a -static compilation, does it pick
libgfortran_static automagically? Shouldn't we make that darwin-
specific, in order to not change the situation on the majority of
other systems that don't have a problem with the current situation?
Thanks,
FX
--
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/