weixin_39597262
weixin_39597262
2020-12-26 01:42

undefined reference to `dggsvd3'

I tried to build trilinos but I got some errors. This is my CMakeError.log:

Performing C++ SOURCE FILE Test HAVE_TEUCHOS_LAPACKLARND failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_6bb30/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_6bb30.dir/build.make CMakeFiles/cmTC_6bb30.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_6bb30.dir/src.cxx.o /opt/openmpi/bin/mpicxx -pedantic -Wall -Wno-long-long -Wwrite-strings -Wshadow -Woverloaded-virtual -O2 -std=c++11 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_TEUCHOS_LAPACKLARND -O3 -DNDEBUG -o CMakeFiles/cmTC_6bb30.dir/src.cxx.o -c /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx: In function 'int main()': /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of '0.0' from 'double' to 'int' inside { } [-Wnarrowing] int seed[4] = { 0.0, 0.0, 0.0, 1.0 }; ^ /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of '0.0' from 'double' to 'int' inside { } [-Wnarrowing] /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of '0.0' from 'double' to 'int' inside { } [-Wnarrowing] /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of '1.0e+0' from 'double' to 'int' inside { } [-Wnarrowing] gmake[1]: [CMakeFiles/cmTC_6bb30.dir/build.make:66: CMakeFiles/cmTC_6bb30.dir/src.cxx.o] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_6bb30/fast] Error 2

Return value: 1 Source file was:

define F77_BLAS_MANGLE(name,NAME) name ## _

define DLARND_F77 F77_BLAS_MANGLE(dlarnd,DLARND)

extern "C" { double DLARND_F77(const int idist, int seed); }

int main() {

const int idist = 1; int seed[4] = { 0.0, 0.0, 0.0, 1.0 };

double val = DLARND_F77(&idist, seed);

return (val < 0.0 ? 1 : 0);

}

Performing C++ SOURCE FILE Test HAVE_CXX_PRAGMA_WEAK failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_6718f/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_6718f.dir/build.make CMakeFiles/cmTC_6718f.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_6718f.dir/src.cxx.o /opt/openmpi/bin/mpicxx -pedantic -Wall -Wno-long-long -Wwrite-strings -Wshadow -Woverloaded-virtual -O2 -std=c++11 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -O3 -DNDEBUG -o CMakeFiles/cmTC_6718f.dir/src.cxx.o -c /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx: In function 'int main()': /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp/src.cxx:14:22: warning: the address of 'void A::theFunction()' will never be NULL [-Waddress] if (A::theFunction != NULL) { ^ Linking CXX executable cmTC_6718f /share/apps/cmake-3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6718f.dir/link.txt --verbose=1 /opt/openmpi/bin/mpicxx -pedantic -Wall -Wno-long-long -Wwrite-strings -Wshadow -Woverloaded-virtual -O2 -std=c++11 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -O3 -DNDEBUG CMakeFiles/cmTC_6718f.dir/src.cxx.o -o cmTC_6718f CMakeFiles/cmTC_6718f.dir/src.cxx.o: In function main': src.cxx:(.text.startup+0x23): undefined reference toA::theFunction()' collect2: error: ld returned 1 exit status gmake[1]: [CMakeFiles/cmTC_6718f.dir/build.make:87: cmTC_6718f] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_6718f/fast] Error 2

Source file was:

include

namespace A { // theFunction never gets defined, because we // don't link with a library that defines it. // That's OK, because it's weak linkage.

pragma weak theFunction

extern void theFunction (); }

int main() { std::cout << "Hi! I am main." << std::endl; if (A::theFunction != NULL) { // Should never be called, since we don't link // with a library that defines A::theFunction. A::theFunction (); } return 0; }

Determining if the function dggsvd3 exists failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_659c6/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_659c6.dir/build.make CMakeFiles/cmTC_659c6.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_659c6.dir/CheckFunctionExists.c.o /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=dggsvd3 -O3 -DNDEBUG -o CMakeFiles/cmTC_659c6.dir/CheckFunctionExists.c.o -c /share/apps/cmake-3.13.1/share/cmake-3.13/Modules/CheckFunctionExists.c Linking C executable cmTC_659c6 /share/apps/cmake-3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_659c6.dir/link.txt --verbose=1 /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=dggsvd3 -O3 -DNDEBUG CMakeFiles/cmTC_659c6.dir/CheckFunctionExists.c.o -o cmTC_659c6 /usr/lib64/liblapack.so /usr/lib64/libblas.so CMakeFiles/cmTC_659c6.dir/CheckFunctionExists.c.o: In function main': CheckFunctionExists.c:(.text.startup+0xc): undefined reference todggsvd3' collect2: error: ld returned 1 exit status gmake[1]: [CMakeFiles/cmTC_659c6.dir/build.make:89: cmTC_659c6] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_659c6/fast] Error 2

Determining if the function dggsvd3_ exists failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_56db8/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_56db8.dir/build.make CMakeFiles/cmTC_56db8.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_56db8.dir/CheckFunctionExists.c.o /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=dggsvd3_ -O3 -DNDEBUG -o CMakeFiles/cmTC_56db8.dir/CheckFunctionExists.c.o -c /share/apps/cmake-3.13.1/share/cmake-3.13/Modules/CheckFunctionExists.c Linking C executable cmTC_56db8 /share/apps/cmake-3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_56db8.dir/link.txt --verbose=1 /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=dggsvd3_ -O3 -DNDEBUG CMakeFiles/cmTC_56db8.dir/CheckFunctionExists.c.o -o cmTC_56db8 /usr/lib64/liblapack.so /usr/lib64/libblas.so CMakeFiles/cmTC_56db8.dir/CheckFunctionExists.c.o: In function main': CheckFunctionExists.c:(.text.startup+0xc): undefined reference todggsvd3_' collect2: error: ld returned 1 exit status gmake[1]: [CMakeFiles/cmTC_56db8.dir/build.make:89: cmTC_56db8] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_56db8/fast] Error 2

Determining if the function DGGSVD3 exists failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_0bdb6/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_0bdb6.dir/build.make CMakeFiles/cmTC_0bdb6.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_0bdb6.dir/CheckFunctionExists.c.o /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=DGGSVD3 -O3 -DNDEBUG -o CMakeFiles/cmTC_0bdb6.dir/CheckFunctionExists.c.o -c /share/apps/cmake-3.13.1/share/cmake-3.13/Modules/CheckFunctionExists.c Linking C executable cmTC_0bdb6 /share/apps/cmake-3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0bdb6.dir/link.txt --verbose=1 /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=DGGSVD3 -O3 -DNDEBUG CMakeFiles/cmTC_0bdb6.dir/CheckFunctionExists.c.o -o cmTC_0bdb6 /usr/lib64/liblapack.so /usr/lib64/libblas.so CMakeFiles/cmTC_0bdb6.dir/CheckFunctionExists.c.o: In function main': CheckFunctionExists.c:(.text.startup+0xc): undefined reference toDGGSVD3' collect2: error: ld returned 1 exit status gmake[1]: [CMakeFiles/cmTC_0bdb6.dir/build.make:89: cmTC_0bdb6] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_0bdb6/fast] Error 2

Determining if the function DGGSVD3_ exists failed with the following output: Change Dir: /share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_1b9b2/fast" /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_1b9b2.dir/build.make CMakeFiles/cmTC_1b9b2.dir/build gmake[1]: Entering directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_1b9b2.dir/CheckFunctionExists.c.o /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=DGGSVD3_ -O3 -DNDEBUG -o CMakeFiles/cmTC_1b9b2.dir/CheckFunctionExists.c.o -c /share/apps/cmake-3.13.1/share/cmake-3.13/Modules/CheckFunctionExists.c Linking C executable cmTC_1b9b2 /share/apps/cmake-3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1b9b2.dir/link.txt --verbose=1 /opt/openmpi/bin/mpicc -pedantic -Wall -Wno-long-long -std=c99 -DCHECK_FUNCTION_EXISTS=DGGSVD3_ -O3 -DNDEBUG CMakeFiles/cmTC_1b9b2.dir/CheckFunctionExists.c.o -o cmTC_1b9b2 /usr/lib64/liblapack.so /usr/lib64/libblas.so CMakeFiles/cmTC_1b9b2.dir/CheckFunctionExists.c.o: In function main': CheckFunctionExists.c:(.text.startup+0xc): undefined reference toDGGSVD3_' collect2: error: ld returned 1 exit status gmake[1]: [CMakeFiles/cmTC_1b9b2.dir/build.make:89: cmTC_1b9b2] Error 1 gmake[1]: Leaving directory '/share/apps/Trilinos-master/build/CMakeFiles/CMakeTmp' gmake: [Makefile:121: cmTC_1b9b2/fast] Error 2

My Environment

  • Relevant configure flags or configure script:
    cmake \ -D CMAKE_INSTALL_PREFIX:PATH=$APPS_PATH/trilinos \ -D MPI_BASE_DIR:PATH=/opt/openmpi \ -D CMAKE_C_COMPILER=/opt/openmpi/bin/mpicc \ -D CMAKE_CXX_COMPILER=/opt/openmpi/bin/mpicxx \ -D CMAKE_Fortran_COMPILER=/opt/openmpi/bin/mpif77 \ -D CMAKE_CXX_FLAGS:STRING="-O2 -std=c++11 -ansi -pedantic -ftrapv -Wall -Wno-long-long" \ -D CMAKE_BUILD_TYPE:STRING=RELEASE \ -D BUILD_SHARED_LIBS=ON \ -D Trilinos_WARNINGS_AS_ERRORS_FLAGS:STRING="" \ -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \ -D Trilinos_ENABLE_Teuchos:BOOL=ON \ -D Trilinos_ENABLE_Shards:BOOL=ON \ -D Trilinos_ENABLE_Sacado:BOOL=ON \ -D Trilinos_ENABLE_Epetra:BOOL=ON \ -D Trilinos_ENABLE_EpetraExt:BOOL=ON \ -D Trilinos_ENABLE_Ifpack:BOOL=ON \ -D Trilinos_ENABLE_AztecOO:BOOL=ON \ -D Trilinos_ENABLE_Amesos:BOOL=ON \ -D Trilinos_ENABLE_Anasazi:BOOL=ON \ -D Trilinos_ENABLE_Belos:BOOL=ON \ -D Trilinos_ENABLE_ML:BOOL=ON \ -D Trilinos_ENABLE_Phalanx:BOOL=ON \ -D Trilinos_ENABLE_Intrepid:BOOL=ON \ -D Trilinos_ENABLE_NOX:BOOL=ON \ -D Trilinos_ENABLE_Stratimikos:BOOL=ON \ -D Trilinos_ENABLE_Thyra:BOOL=ON \ -D Trilinos_ENABLE_Rythmos:BOOL=ON \ -D Trilinos_ENABLE_MOOCHO:BOOL=ON \ -D Trilinos_ENABLE_TriKota:BOOL=OFF \ -D Trilinos_ENABLE_Stokhos:BOOL=ON \ -D Trilinos_ENABLE_Zoltan:BOOL=ON \ -D Trilinos_ENABLE_Piro:BOOL=ON \ -D Trilinos_ENABLE_Teko:BOOL=ON \ -D Trilinos_ENABLE_SEACASIoss:BOOL=ON \ -D Trilinos_ENABLE_SEACAS:BOOL=ON \ -D Trilinos_ENABLE_SEACASBlot:BOOL=ON \ -D Trilinos_ENABLE_Pamgen:BOOL=ON \ -D Trilinos_ENABLE_EXAMPLES:BOOL=OFF \ -D Trilinos_ENABLE_TESTS:BOOL=OFF \ -D TPL_ENABLE_MATLAB:BOOL=OFF \ -D TPL_ENABLE_Matio:BOOL=OFF \ -D TPL_ENABLE_QT:BOOL=OFF \ -D TPL_ENABLE_HDF5:BOOL=ON \ -D HDF5_INCLUDE_DIRS:PATH=$APPS_PATH/hdf5-1.10.3/include \ -D HDF5_LIBRARY_DIRS:PATH=$APPS_PATH/hdf5-1.10.3/lib \ -D TPL_ENABLE_Netcdf:BOOL=ON \ -D Netcdf_INCLUDE_DIRS:PATH=$APPS_PATH/netcdf/include \ -D Netcdf_LIBRARY_DIRS:PATH=$APPS_PATH/netcdf/lib \ -D TPL_ENABLE_MPI:BOOL=ON \ -D MPI_EXEC_DEFAULT_NUMPROCS=10 \ -D TPL_ENABLE_BLAS:BOOL=ON \ -D TPL_BLAS_LIBRARIES:STRING=/usr/lib64/libblas.so \ -D TPL_ENABLE_LAPACK:BOOL=ON \ ..
  • Operating system and version:
    CentOS release 6.9
  • Compiler and TPL versions:
    gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) GNU Fortran (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) cmake version 3.13.20181130-g654fd liblapack version: 3.2.1 libblas version: 3.2.1

Additional Information

I can not change the OS because it is a server that runs many jobs. Please help me fix this error without changing the OS.

该提问来源于开源项目:trilinos/Trilinos

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39597262 weixin_39597262 3月前

    It's solved with this fix issue: #4131. Thank you very much!

    点赞 评论 复制链接分享
  • weixin_39866817 weixin_39866817 3月前

    I'm a bit confused -- what was the actual error? The log output might say "error" but that's just temporary output from the CMake tests. Also, it would help for us to learn a little bit more about your application -- would you mind sharing that?

    点赞 评论 复制链接分享
  • weixin_39866817 weixin_39866817 3月前
    1. I notice that you specified the path to the BLAS library explicitly in your CMake options, but did not specify the path to the LAPACK library. The linker errors are looking for /usr/lib64/liblapack.so. Does that file exist on your system? Also, it's better to specify TPL library directories via ${TPLNAME}_LIBRARY_DIRS (and ${TPLNAME}_LIBRARY_NAMES if needed). This gives Trilinos more opportunity to check paths and files, and might actually help diagnose the issue here. See Trilinos/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst.
    2. The (closed) Trilinos issue #480 might be relevant to the missing dggsvd3 routine. In short, try upgrading your LAPACK version as a work-around. If you can't change the installed LAPACK version, you could build LAPACK yourself. (It has a CMake-based build system that isn't so hard to use.)
    3. What version of Trilinos is this?
    4. Please do not use the -Wno-long-long option. C++11 promises long long as a built-in type. Trilinos works just fine with long long. In fact, consider deleting all CMAKE_CXX_FLAGS options but -ansi -pedantic -Wall. You have specified CMAKE_BUILD_TYPE:STRING=RELEASE; this will set -O2 by default. I would not recommend -ftrapv unless you know what you're doing.
    点赞 评论 复制链接分享
  • weixin_39866817 weixin_39866817 3月前

    wrote:

    I tried to build trilinos but I got some errors.

    Instead of showing us the log file, could you please show us a subset of your actual CMake output (what cmake printed on the screen) that gives an error?

    点赞 评论 复制链接分享

为你推荐