-
Notifications
You must be signed in to change notification settings - Fork 479
Closed
Labels
Description
Description
When building a BLAS shared library with cmake -DBUILD_SHARED_LIBS=ON
with CMake releases before version 3.11, linking of the BLAS library will fail:
[ 27%] Linking Fortran shared library ../../lib/libblas.so
CMakeFiles/blas_64_obj.dir/blas_64_obj/isamax.f.o: In function `isamax_':
/tmp/build/BLAS/SRC/blas_64_obj/isamax.f:70: multiple definition of `isamax_'
CMakeFiles/blas_obj.dir/isamax.f.o:/home/docker/lapack/BLAS/SRC/isamax.f:70: first defined here
CMakeFiles/blas_64_obj.dir/blas_64_obj/lsame.f.o: In function `lsame_':
/tmp/build/BLAS/SRC/blas_64_obj/lsame.f:52: multiple definition of `lsame_'
CMakeFiles/blas_obj.dir/lsame.f.o:/home/docker/lapack/BLAS/SRC/lsame.f:52: first defined here
CMakeFiles/blas_64_obj.dir/blas_64_obj/sasum.f.o: In function `sasum_':
/tmp/build/BLAS/SRC/blas_64_obj/sasum.f:71: multiple definition of `sasum_'
CMakeFiles/blas_obj.dir/sasum.f.o:/home/docker/lapack/BLAS/SRC/sasum.f:71: first defined here
[snip]
The cause is an attempt to set the source file property COMPILE_OPTIONS
:
lapack/BLAS/SRC/CMakeLists.txt
Lines 140 to 143 in d7ea9c5
list(APPEND COPT_64_F "-D${FUNC}=${FUNC}_64") | |
endforeach() | |
list(REMOVE_DUPLICATES COPT_64_F) | |
set_source_files_properties(${F} PROPERTIES COMPILE_OPTIONS "${COPT_64_F}") |
This property exists only from CMake 3.11 onwards and these compiler options would avoid the name clash.
There are two possible fixes:
- Require at least CMake 3.11 for building LAPACK
- Use the
COMPILE_FLAGS
andCOMPILE_DEFINITIONS
properties
Checklist
- I've included a minimal example to reproduce the issue
- I'd be willing to make a PR to solve this issue
langou