Skip to content

LAPACK requires CMake 3.11 or newer #975

@christoph-conrads

Description

@christoph-conrads

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:

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:

Checklist

  • I've included a minimal example to reproduce the issue
  • I'd be willing to make a PR to solve this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions