Building shared library with gfortran. Bug?

Steve Ellcey sje@cup.hp.com
Thu Mar 15 09:56:00 GMT 2007


> It's perfectly OK to link against static libraries when building a shared 
> librariy. In the case of gfortranbegin there won't be anything that requires 
> main(), so -lgfortranbegin does precisely nothing.
> 
> Shared libraries are just that: libraries. Having a "program" or "main" block 
> in them doesn't make a whole lot of sense.

The problem I am running into is that when I build libgfortran (using
the new libtool), gfortran cannot find libgfortranbegin.  The link is
done using the newly build gfortran compiler and -B options to look in
various places:

/proj/svn.libtool/build-ia64-hp-hpux11.23-trunk/obj_gcc/./gcc/gfortran
  -B/proj/svn.libtool/build-ia64-hp-hpux11.23-trunk/obj_gcc/./gcc/
  -B/proj/svn.libtool/gcc-ia64-hp-hpux11.23-trunk/ia64-hp-hpux11.23/bin/
  -B/proj/svn.libtool/gcc-ia64-hp-hpux11.23-trunk/ia64-hp-hpux11.23/lib/
  .....

But libgfortranbegin is found in the libgfortran subdirectory not the
gcc subdirectory (where the crt and libgcc files are) and so the link
fails when it can't find libgfortranbegin.  We could fix this by adding
another -B option to the libgfortran call, but before doing that I
thought I would see if it should be there at all.

Steve Ellcey
sje@cup.hp.com



More information about the Fortran mailing list