[Trilinos-Users] libblas

James Elliott jjellio3 at ncsu.edu
Fri Apr 28 11:43:06 EDT 2017

Hi Elek,

The best way is to require gfortran as a BLAS/LAPACK required library.

To do this, you add gfortran to:

-D BLAS_LIBRARY_DIRS:PATH=" /users/kdm/ewpostek/LAPACK/lib" \
-D BLAS_LIBRARY_NAMES:STRING="blas;gfortran" \

Above assumes CMake will be able to find gfortran in some standard
location. If it cannot find gfortran (you will get a configure error),
then add the proper path to the list:

-D BLAS_LIBRARY_DIRS:PATH="/users/kdm/ewpostek/LAPACK/lib;/path/to/directory/with/gfortran"
-D BLAS_LIBRARY_NAMES:STRING="blas;gfortran" \

You could also set the CMake variable CMAKE_EXE_LINKER_FLAGS, which
will append these options to every executable linked.

or if you need to specify the path:
-DCMAKE_EXE_LINKER_FLAGS="-L/path/to/directory/with/gfortran -lgfortran"

I favor setting this in the BLAS/LAPACK libraries, because it will
force CMake to make sure that libgfortran is present on the system.
CMake will also show you the path it finds for this library, which is
very useful information.

Hope that helps!


On 4/28/17, Eligiusz Postek <ewpostek at googlemail.com> wrote:
> Dear Colleagues,
> I am building the Trilinos,
> and I get the comments:
> [  4%] Built target teuchosnumerics
> Linking CXX executable TeuchosNumerics_BLAS_ROTG_test.exe
> /users/kdm/ewpostek/LAPACK/lib/libblas.a(xerbla.f.o): In function
> `xerbla_':
> xerbla.f:(.text+0x79): undefined reference to `_gfortran_st_write'
> xerbla.f:(.text+0x90): undefined reference to `_gfortran_string_len_trim'
> Could you say where to put "-lgfortran" in the script,
> or whatever else should be there?
> Could you help with it?
> best regards, Elek

More information about the Trilinos-Users mailing list