Shared lib build fails blas test due to missing -lgfortran
Created by: rrdrake
I am trying to build Trilinos (master from today) with -DBUILD_SHARED_LIBS=ON but the blas test gives (among other blas messages)
-- Performing Test HAVE_TEUCHOS_BLASFLOAT
-- Performing Test HAVE_TEUCHOS_BLASFLOAT - Failed
-- Performing Test HAVE_TEUCHOS_BLASFLOAT_DOUBLE_RETURN
-- Performing Test HAVE_TEUCHOS_BLASFLOAT_DOUBLE_RETURN - Failed
Looking in the CMakeError.log file, I see
Building CXX object CMakeFiles/cmTC_4c240.dir/src.cxx.o
/projects/alegra/mpi/ompi1.8.3_gcc492/bin/mpiCC -std=c++11 -O2 -funroll-loops -DCODE_MP -DOMPI_SKIP_MPICXX -DNDEBUG -std=c++11 -DHAVE_TEUCHOS_BLASFLOAT -o CMakeFiles/cmTC_4c240.dir/src.cxx.o -c /scratch/rrdrake/tpl/TPL/trilinos/2018_01_13/build/gnu49_opt_shared/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_4c240
/projects/alegra/TPL/cmake/3.6.3/inst_Linux.x86_64/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4c240.dir/link.txt --verbose=1
/projects/alegra/mpi/ompi1.8.3_gcc492/bin/mpiCC -std=c++11 -O2 -funroll-loops -DCODE_MP -DOMPI_SKIP_MPICXX -DNDEBUG -std=c++11 -DHAVE_TEUCHOS_BLASFLOAT CMakeFiles/cmTC_4c240.dir/src.cxx.o -o cmTC_4c240 -rdynamic -L/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared -lblas
/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared/libblas.so: undefined reference to `_gfortran_st_write_done'
/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared/libblas.so: undefined reference to `_gfortran_st_write'
/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared/libblas.so: undefined reference to `_gfortran_transfer_integer_write'
/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared/libblas.so: undefined reference to `_gfortran_transfer_character_write'
/projects/alegra/TPL/lapackblas/3.0-n1/lib/gnu49_opt_shared/libblas.so: undefined reference to `_gfortran_stop_string'
collect2: error: ld returned 1 exit status
gmake[1]: *** [cmTC_4c240] Error 1
gmake[1]: Leaving directory `/scratch/rrdrake/tpl/TPL/trilinos/2018_01_13/build/gnu49_opt_shared/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_4c240/fast] Error 2
Maybe I am reading that wrong, but it seems like the test does a link with C++ but fails due to missing fortran libraries. Later on I get the error
CMake Error at packages/tpetra/CMakeLists.txt:822 (MESSAGE):
Tpetra: Tpetra_INST_FLOAT is ON (meaning that you want to instantiate
and/or test Tpetra with Scalar = float), but HAVE_TEUCHOS_BLASFLOAT is OFF.
This means that you are linking with a BLAS library that lacks float (S)
support. Tpetra needs a BLAS implementation that supports float.
I tried using -DTrilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran"
, but that never appeared on the test link line.
How do I get -lgfortran
to appear on the end of test link lines?
Thanks,
-rich