[CMake] cmake ld fails

Michael Hertling mhertling at online.de
Wed May 19 01:17:41 EDT 2010


On 05/18/2010 11:13 PM, R. Bryn Fenwick wrote:
> 
> Hi,
> 
> I have received some code that works on one system, but is failing to  
> work for me. Any suggestions how to debug this would be greatly  
> appreciated.
> 
> I think that I am setting everything up correctly however it appears  
> to need some hacks.
> 
> Scanning dependencies of target scimap
> [  3%] Building CXX object src/CMakeFiles/scimap.dir/confstream.cpp.o
> [  7%] Building CXX object src/CMakeFiles/scimap.dir/densematrix.cpp.o
> [ 11%] Building CXX object src/CMakeFiles/scimap.dir/distance.cpp.o
> [ 15%] Building CXX object src/CMakeFiles/scimap.dir/fibheap.cpp.o
> [ 19%] Building CXX object src/CMakeFiles/scimap.dir/gzstream.cpp.o
> [ 23%] Building CXX object src/CMakeFiles/scimap.dir/sparsematrix.cpp.o
> [ 26%] Building CXX object src/CMakeFiles/scimap.dir/util.cpp.o
> [ 30%] Building CXX object src/CMakeFiles/scimap.dir/VarMatrix.cpp.o
> [ 34%] Building C object src/CMakeFiles/scimap.dir/RMPbheap.c.o
> [ 38%] Building C object src/CMakeFiles/scimap.dir/RMPfbheap.c.o
> [ 42%] Building C object src/CMakeFiles/scimap.dir/RMPkcenter.c.o
> [ 46%] Building C object src/CMakeFiles/scimap.dir/RMPksplit.c.o
> [ 50%] Building C object src/CMakeFiles/scimap.dir/RMPpermutation.c.o
> [ 53%] Building C object src/CMakeFiles/scimap.dir/RMPprime.c.o
> [ 57%] Building C object src/CMakeFiles/scimap.dir/RMPrandom.c.o
> [ 61%] Building C object src/CMakeFiles/scimap.dir/RMPset.c.o
> Linking CXX static library ../libscimap.a
> [ 61%] Built target scimap
> Scanning dependencies of target embedding
> [ 65%] Building CXX object src/CMakeFiles/embedding.dir/embedding.cpp.o
> Linking CXX executable ../embedding
> ../libscimap.a(densematrix.cpp.o): In function  
> `DenseMatrix::cost_matrix(SparseMatrix&)':
> densematrix.cpp:(.text+0x1a50): undefined reference to `dgemm_'
> ../libscimap.a(densematrix.cpp.o): In function  
> `DenseMatrix::largest_eigenvectors(int&, DenseMatrix&, double*, int*)':
> densematrix.cpp:(.text+0x3784): undefined reference to `dgemv_'
> densematrix.cpp:(.text+0x3849): undefined reference to `dgemv_'
> densematrix.cpp:(.text+0x3a6a): undefined reference to `dgemm_'
> ../../../ARPACK/libparpack.a(pdseupd.o): In function `pdseupd_':
> pdseupd.f:(.text+0x70c): undefined reference to `dcopy_'
> 
> many more similar errors follow including these for lapack itself...
> 
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarfg.f:116: undefined reference  
> to `dnrm2_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarfg.f:120: undefined reference  
> to `dscal_'
> /home/fenwick/opt/lapack-3.2.1/liblapack_LINUX.a(dlarft.o): In  
> function `dlarft_':
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:157: undefined reference  
> to `dgemv_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:169: undefined reference  
> to `dgemv_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:176: undefined reference  
> to `dtrmv_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:214: undefined reference  
> to `dgemv_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:230: undefined reference  
> to `dgemv_'
> /home/fenwick/opt/lapack-3.2.1/SRC/dlarft.f:237: undefined reference  
> to `dtrmv_'
> /home/fenwick/opt/lapack-3.2.1/liblapack_LINUX.a(dorg2r.o): In  
> function `dorg2r_':
> /home/fenwick/opt/lapack-3.2.1/SRC/dorg2r.f:117: undefined reference  
> to `dscal_'
> /home/fenwick/opt/lapack-3.2.1/liblapack_LINUX.a(dorgl2.o): In  
> function `dorgl2_':
> /home/fenwick/opt/lapack-3.2.1/SRC/dorgl2.f:120: undefined reference  
> to `dscal_'
> 
> 
> 
> I generate the makefiles with:
> 
> CC=/opt/mvapich2-1.2rc1/bin/mpicc CXX=/opt/mvapich2-1.2rc1/bin/mpicxx  
> cmake -DCMAKE_BUILD_TYPE=Release ../.. -DCMAKE_EXE_LINKER_FLAGS='-L/ 
> home/opt/lapack-3.2.1' -DMPIEXEC='/opt/mvapich2-1.2rc1/bin/mpiexec
> ' -DCMAKE_MODULE_LINKER_FLAGS='-L/home/fenwick/opt/lapack-3.2.1'
> 
> I am trying to use lapack though in the CmakeLists file there is no  
> mention of a fortran compiler
> 
> project(SCIMAP CXX C)
> cmake_minimum_required(VERSION 2.6)
> 
> set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
> set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
> set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
> 
> find_package(ZLIB REQUIRED)
> 
> # Find MPI
> set(MPI_COMPILER "/opt/mvapich2-1.2rc1/bin/mpicxx")
> set(MPI_LIBRARY "/opt/mvapich2-1.2rc1/lib/libmpich.a")
> set(MPI_INCLUDE_PATH "/opt/mvapich2-1.2rc1/include")
> set(MPI_FLAGS "-DMPICH_IGNORE_CXX_SEEK")
> find_package(MPI REQUIRED)
> 
> find_package(LAPACK REQUIRED)
> #find_package(BLAS   REQUIRED)
> find_package(ARPACK REQUIRED)
> include_directories(${ZLIB_INCLUDE_DIR} ${MPI_INCLUDE_PATH})
> add_definitions(${MPI_COMPILE_FLAGS})
> set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} $ 
> {MPI_LINK_FLAGS}")
> set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} $ 
> {MPI_LINK_FLAGS}")
> 
> add_subdirectory(src)

Obviously, the linker can't find all necessary symbols in the named
libraries to link against, but most probably, the relevant stuff is
set up in src/CMakeLists.txt, so please post this file, too.

Regards,

Michael


More information about the CMake mailing list