libgfortran linking problem

Tim Holme timholme@gmail.com
Thu Jun 25 22:46:00 GMT 2009


when compiling a fortran program with gfortran and linking with
-lgfortran, I'm having undefined references to gfortran programs.

>gfortran -o foo [lots of .o files]  -L/usr/pubsw/lib/ -llapack -L/usr/pubsw/lib/ -lblas -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lgfortran -lgfortranbegin

For example, I get error messages related to:

undefined reference to `_gfortran_transfer_array'
undefined reference to `_gfortran_os_error'

both of these functions appear in the libgfortran I'm linking against:

> nm /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a | grep os_error
0000000000000840 T _gfortran_os_error
0000000000000840 T _gfortrani_os_error
                 U _gfortrani_os_error
                 U _gfortrani_os_error

> nm /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a | grep transfer_array
0000000000000670 T _gfortran_transfer_array

How can I link in libgfortran properly? Is it a versioning issue?  I
find my gfortran version :

> gfortran --version
GNU Fortran (Ubuntu 4.3.3-5ubuntu4) 4.3.3

and I link against the libgfortran in a 4.3 directory:
/usr/lib/gcc/x86_64-linux-gnu/4.3

Any ideas?  Thanks very much,
T



More information about the Gcc-help mailing list