Red Hat Bugzilla – Bug 191497
"gcc -lgfortran" fails because libgfortran RPM lacks libgfortran.so
Last modified: 2007-11-30 17:11:32 EST
libgfortran 4.1.0 does not install /usr/lib/libgfortran.so
on which some executables rely.
the user has to create a symlink:
test -f libgfortran.so || sudo ln -sv libgfortran.so.*.* libgfortran.so
(there is no component named libgfortran in bugzilla, so I have to use gcc which
is the source of the Fortran 95 runtime)
Programs which do that are incredibly broken.
libgfortran.so is included in gcc/gfortran specific directory, similarly
to other gcc provided libraries, as what exactly this points to is dependent
on the compiler version used (you need different libgfortran (libgfortran.so.0)
when using GCC 4.0.x, different when using 4.1.x (libgfortran.so.1) and yet
different when using 4.2.x (libgfortran.so.2)).
So, rather than using crappy checks for /usr/lib/libgfortran.so (after all,
on x86_64, ppc64, s390x etc. that wouldn't be in /usr/lib64 anyway) they should
use standard (e.g. autoconf) checks for presence of libraries.
without the symbolic link /usr/lib/libgfortran.so, "-lgfortran" does not work:
/usr/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
I am reopening the bug:
how do I recompile my program so that it uses /usr/lib/libgfortran.so.1?
When you forgot to install gcc-gfortran package, that's not really surprising.
If you install it, that command will work just fine.
I have these packages:
(Alas, I am stuck with c++ software that want 3.2)
If you are using compat-gcc-32, then you obviously can't mix that with gfortran,
you should use compat-gcc-32 with g77 (and it's -lg2c), or gcc 4.x with gfortran.
Please stop reopening this.