diff --git a/var/spack/repos/builtin/packages/suite-sparse/graphblas_libm_dep.patch b/var/spack/repos/builtin/packages/suite-sparse/graphblas_libm_dep.patch new file mode 100644 index 0000000000..441b0eff87 --- /dev/null +++ b/var/spack/repos/builtin/packages/suite-sparse/graphblas_libm_dep.patch @@ -0,0 +1,10 @@ +--- a/GraphBLAS/CMakeLists.txt ++++ b/GraphBLAS/CMakeLists.txt +@@ -87,6 +87,7 @@ + C_STANDARD_REQUIRED 11 + PUBLIC_HEADER "Include/GraphBLAS.h" ) + set_property ( TARGET graphblas PROPERTY C_STANDARD 11 ) ++target_link_libraries ( graphblas m ) + + # create the static graphblas library. Requires ANSI C11 + add_library ( graphblas_static STATIC ${GRAPHBLAS_SOURCES} ) diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py index 7d89be0326..6b22e76f0e 100644 --- a/var/spack/repos/builtin/packages/suite-sparse/package.py +++ b/var/spack/repos/builtin/packages/suite-sparse/package.py @@ -60,6 +60,10 @@ class SuiteSparse(Package): # This patch removes unsupported flags for pgi compiler patch('pgi.patch', when='%pgi') + # This patch adds '-lm' when linking libgraphblas and when using clang. + # Fixes 'libgraphblas.so.2.0.1: undefined reference to `__fpclassify'' + patch('graphblas_libm_dep.patch', when='@5.2.0:%clang') + def install(self, spec, prefix): # The build system of SuiteSparse is quite old-fashioned. # It's basically a plain Makefile which include an header