[cmake-developers] [CMake 0012912]: FindLAPACK does not work when trying static linking

Mantis Bug Tracker mantis at public.kitware.com
Tue Jan 24 21:23:02 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12912 
====================================================================== 
Reported By:                tgallagher
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12912
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-01-24 21:23 EST
Last Modified:              2012-01-24 21:23 EST
====================================================================== 
Summary:                    FindLAPACK does not work when trying static linking
Description: 
The FindLAPACK module does not work when trying to use static linking. When
trying to compile the test file to check if the library works, it gives:

/usr/bin/gfortran        
CMakeFiles/cmTryCompileExec.dir/testFortranCompiler.f.o  -o cmTryCompileExec
 -rdynamic -Wl,--start-group /usr/lib/liblapack.a /usr/lib/libblas.a
-Wl,--end-group
/usr/lib/libblas.a(xerbla.o): In function `xerbla_':
(.text+0x0): multiple definition of `xerbla_'
/usr/lib/liblapack.a(xerbla.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [cmTryCompileExec] Error 1
make[2]: Leaving directory `/data/lagrangianBuild/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec.dir/all] Error 2
make[1]: Leaving directory `/data/lagrangianBuild/CMakeFiles/CMakeTmp'
make: *** [all] Error 2

The double-definition is because the static liblapack already has all the code
it needs from libblas in it, but the FindLAPACK module calls FindBLAS and links
against both liblapack and libblas. 

The solution is to check if BLA_STATIC is set, do not call find_package(BLAS)
because the lapack library will already have all the functions it needs in it. 

Steps to Reproduce: 
Compile something using the find_package(LAPACK REQUIRED) signature with
BLA_STATIC defined. 

Additional Information: 
I have many other fixes related to FindBLAS and FindLAPACK as well as a new
module request. If approved for the new module and given access, I can fix this
bug as well. 
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-24 21:23 tgallagher     New Issue                                    
======================================================================




More information about the cmake-developers mailing list