-static-libgfortran and libquadmath

Jack Howarth howarth@bromo.med.uc.edu
Thu Nov 18 23:19:00 GMT 2010


On Thu, Nov 18, 2010 at 10:56:14AM -0800, Steve Kargl wrote:
> On Thu, Nov 18, 2010 at 12:55:27PM -0500, Jack Howarth wrote:
> > On Thu, Nov 18, 2010 at 07:46:15AM -0800, Steve Kargl wrote:
> > > 
> > > If one wants static linkage, then use -static.  Otherwise,
> > > if one wants to selectively permit static linkage of individually
> > > required libraries, then shouldn't there be a switch for each
> > > library, ie., -static-libm, -static-libc, and -static-libgomp. 
> > > 
> > > Also note that Fortran allows the radix of the floating point
> > > types to be other than 2.  So, if one has the inclination,
> > > one could use libdecnumber for a radix 10 REAL.  You'll need
> > > to add -static-libdecnumber as well.  This seems to be a
> > > slippery slope.
> > > 
> > 
> > Steve,
> >    The -static option has always been (by design) non-functional on darwin.
> > >From the Apple gcc man page...
> > 
> >    -static
> >     On systems that support dynamic linking, this prevents
> >     linking with the shared libraries.  On other systems, this
> >     option has no effect.
> > 
> >     This option will not work on Mac OS X unless all libraries
> >     (including libgcc.a) have also been compiled with -static.
> >     Since neither a static version of libSystem.dylib nor crt0.o
> >     are provided, this option is not useful to most people.
> > 
> > Hence the original interest on darwin for a functional
> > -static-libgfortran (and now a -static-libquadmath) option.
> 
> Are you advocating for -static-libm, -static-libdecnumber,
> -static-libc, etc?

Steve,
   No one is suggesting any such thing. Those are system libraries
which will never exist as static libraries in a real-world darwin
installation. The list of potential candidates for -static-xxxx
flags would only be those libraries belonging to the FSF gcc
installation itself. Since libquad has been added to that list,
it qualifies for a -static-libquad flag.
            Jack

> 
> % gfc4x -o z f.f && ldd z
>         libgfortran.so.3 => /home/sgk/work/4x/lib/libgfortran.so.3
>         libm.so.5 => /lib/libm.so.5
>         libgcc_s.so.1 => /home/sgk/work/4x/lib/libgcc_s.so.1
>         libquadmath.so.0 => /home/sgk/work/4x/lib/libquadmath.so.0
>         libc.so.7 => /lib/libc.so.7
> % gfc4x -o z -static-libgfortran f.f && ldd z
>         libm.so.5 => /lib/libm.so.5
>         libgcc_s.so.1 => /home/sgk/work/4x/lib/libgcc_s.so.1
>         libquadmath.so.0 => /home/sgk/work/4x/lib/libquadmath.so.0
>         libc.so.7 => /lib/libc.so.7
> % gfc4x -o z -static-libgfortran -static-libgcc f.f && ldd z
>         libm.so.5 => /lib/libm.so.5 (0x20076f000)
>         libquadmath.so.0 => /home/sgk/work/4x/lib/libquadmath.so.0 (0x200892000)
>         libc.so.7 => /lib/libc.so.7 (0x2009c2000)
> % gfc4x -o z -static-libgfortran -static-libgcc -static-libc f.f
> gfortran: error: unrecognized option '-static-libc'
> % gfc4x -o z -static-libgfortran -static-libgcc -static-libm f.f
> gfortran: error: unrecognized option '-static-libm'
> % gfc4x -o z -static-libgfortran -static-libgcc -static-libquadmath f.f
> gfortran: error: unrecognized option '-static-libquadmath'
> 
> Perhaps, the darwin maintainers should map -static to mean
> link all available *.a libraries into the final object/image
> while maintaining the lack (brokeness?) of a static libgcc
> and libSystem.dylib.

ps. It is difficult to imagine how -static could be made to work
on darwin since the system libraries are rarely available as static
libs. Also, since -static implies that everything should be treated
as being available as static libs, it is difficult to see how
the compiler could guess which libraries passed with the -l flag
are actually available as static libs (short of dynamically checking
for them in the linkage paths).

> 
> -- 
> Steve



More information about the Fortran mailing list