lgfortran not found

I recently updated my work computer from 6_3 to 7_1 (the full reinstall way). Everything runs correctly except for what seems like a problem building ports with gfortran. I'm trying to get a couple of numerical programs [R, numpy] to compile on my machine. I installed both gcc42 and gcc43 and both libgfortran libraries are correctly (from what I know) installed and found with ldconfig.

Code:
> ldconfig -r | grep
1170:-lgfortran.2 => /usr/local/lib/gcc-4.2.5/libgfortran.so.2
1182:-lgfortran.3 => /usr/local/lib/gcc-4.3.3/libgfortran.so.3

However py-numpy build fails with the following output:
Code:
######################################
...
creating build/temp.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg
compile options: '-DNO_ATLAS_INFO=2 -I/usr/local/include -Inumpy/core/include -Ibuild/src.freebsd-7.1-RELEASE-p2-i386-
2.5/numpy/core/include/numpy -Inumpy/core/src -Inumpy/core/include -I/usr/local/include/python2.5 -c'
cc: numpy/linalg/python_xerbla.c
cc: numpy/linalg/lapack_litemodule.c
cc -shared -pthread -O2 -fno-strict-aliasing -pipe build/temp.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/lapack_litemodule.o 
build/temp.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/python_xerbla.o -L/usr/local/lib -lalapack_r -lalapack_r -lf77blas_r -lcblas_r -
latlas_r -lgfortran -lm -lpthread -o build/lib.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/lapack_lite.so
/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lgfortran
error: Command "cc -shared -pthread -O2 -fno-strict-aliasing -pipe build/temp.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/lapack_litemodule.o 
build/temp.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/python_xerbla.o -L/usr/local/lib -lalapack_r -lalapack_r -lf77blas_r -lcblas_r -
latlas_r -lgfortran -lm -lpthread -o build/lib.freebsd-7.1-RELEASE-p2-i386-2.5/numpy/linalg/lapack_lite.so" failed with exit status 1
*** Error code 1

Stop in /usr/ports/math/py-numpy.
*** Error code 1

Stop in /usr/ports/math/py-numpy.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade.2847.0 env make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! math/py-numpy (compiler error)
#########################################

and R fails with this output:
Code:
#########################################
mkdir /usr/ports/math/R/work/R-2.8.1/lib
cc -std=gnu99      -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H  -fpic  -O2 -fno-strict-aliasing -pipe -c 
Rmain.c -o Rmain.o
cc -std=gnu99 -export-dynamic -L/usr/local/lib -o R.bin Rmain.o -L../../lib -lR
/usr/local/lib/libblas.so.2: undefined reference to `_gfortran_runtime_error_at'
*** Error code 1

Stop in /usr/ports/math/R/work/R-2.8.1/src/main.
*** Error code 1

Stop in /usr/ports/math/R/work/R-2.8.1/src/main.
*** Error code 1

Stop in /usr/ports/math/R/work/R-2.8.1/src.
*** Error code 1

Stop in /usr/ports/math/R/work/R-2.8.1.
*** Error code 1

Stop in /usr/ports/math/R.
*** Error code 1

Stop in /usr/ports/math/R.
######################################

Both problems occur with or without using the ATLAS [math/atlas] libraries. I've rebuilt math/lapack and math/blas with no luck as lately as today with no change, I'm not about to rebuild ATLAS unless absolutely needed (18 hours).

Any thoughts on either of these problems? I've searched the web thinking that this would definitely be a common problem since I did not do anything unusual when installing 7_1. I only see the R problem on one hit with no solution. Something about USE_FORTRAN=yes now meaning gfortran4.3 is used as the default fortran compiler. That didn't help me much.


Thanks for any help in advance.
 
I have to set a link to gfortran in this way:

ln -s /usr/local/bin/gfortran42 /usr/local/bin/gfortran

OR

ln -s /usr/local/bin/gfortran43 /usr/local/bin/gfortran

This depends on what version you want to use. After that, math/R and math/py-numpy are able to find the gfortran compiler.

I hope this helps,
Rainer
 
I eventually gave up and reinstalled all my ports. That worked quite nicely, and didn't take as long as I imagined.

I have since updated to FBSD 7.2 with no problems.
 
Thank you, rhurlin, for your post. I was trying to compile scipy from source, and got the following
Code:
error: library dfftpack has Fortran sources but no Fortran compiler found"\

I created the link from gfortran45 to gfortran, as you suggested, and it compiled like a charm.
 
Back
Top