Bugzilla – Bug 137285
Blas/Lapack library doesn't link with g++
Last modified: 2005-12-07 10:46:29 UTC
I use Lapack library to link to my c++ code, see attachment for a simple example. This example worked in SUSE 9.2, but in SUSE 10.0 I get g++ main.cc -lblas -llapack /usr/lib/gcc/i586-suse-linux/4.0.2/../../../libblas.so: undefined reference to `_gfortran_st_write' /usr/lib/gcc/i586-suse-linux/4.0.2/../../../liblapack.so: undefined reference to `_gfortran_pow_r8_i4' ..... collect2: ld returned 1 exit status make: *** [all] Error 1
Created attachment 59963 [details] Example of (almost empty) code that doesn't link.
Adding -lgfortran to the link command, i.e. using -lblas -llapack -lgfortran (this needs the gcc-fortran package to be installed) should fix this. The reason for the change is, that SUSE Linux 9.2 contained gcc 3.3.4 which had f77 as a fortran compiler. Now SUSE Linux 10.0 uses gcc 4.0.2 which in turn uses gfortran instead of f77.