From 1b54171d54671bf4266e3cb407d7c604d12f33fb Mon Sep 17 00:00:00 2001 From: s Date: Tue, 25 Jul 2023 12:57:55 +0800 Subject: [PATCH] fix clang build error --- fix-clang.patch | 14 ++++++++++++++ suitesparse.spec | 21 ++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 fix-clang.patch diff --git a/fix-clang.patch b/fix-clang.patch new file mode 100644 index 0000000..af5853b --- /dev/null +++ b/fix-clang.patch @@ -0,0 +1,14 @@ +diff -u -r SuiteSparse-5.10.1/SuiteSparse_config/SuiteSparse_config.mk SuiteSparse-5.10.1/SuiteSparse_config/SuiteSparse_config.mk +--- SuiteSparse-5.10.1/SuiteSparse_config/SuiteSparse_config.mk 2021-05-18 21:01:16.000000000 +0800 ++++ SuiteSparse-5.10.1/SuiteSparse_config/SuiteSparse_config.mk 2023-07-25 12:52:14.000000000 +0800 +@@ -117,7 +117,9 @@ + + # with gcc, enable OpenMP directives via -fopenmp + # This is not supported on Darwin, so this string is cleared, below. +- CFOPENMP ?= -fopenmp ++ ifeq ($(CC), gcc) ++ CFOPENMP ?= -fopenmp ++ endif + + #--------------------------------------------------------------------------- + # compiler diff --git a/suitesparse.spec b/suitesparse.spec index d9ce9d3..14d4222 100644 --- a/suitesparse.spec +++ b/suitesparse.spec @@ -1,10 +1,11 @@ Name: suitesparse Version: 5.10.1 -Release: 2 +Release: 3 Summary: Sparse Matrix Collection License: (LGPLv2+ or BSD) and LGPLv2+ and GPLv2+ URL: http://faculty.cse.tamu.edu/davis/suitesparse.html Source0: http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-%{version}.tar.gz +Patch0: fix-clang.patch BuildRequires: gcc-c++ openblas-devel tbb-devel hardlink lapack-devel openblas-devel metis-devel chrpath Obsoletes: umfpack <= 5.0.1 ufsparse <= 2.1.1 Provides: ufsparse = %{version}-%{release} @@ -59,8 +60,10 @@ done sed -i -e '/^ CF =/ s/ -O3 -fexceptions//' SuiteSparse_config/SuiteSparse_config.mk %build -export AUTOCC=no -export CC=gcc +%if "%toolchain" != "clang" + export AUTOCC=no + export CC=gcc +%endif install -d Doc/{AMD,BTF,CAMD,CCOLAMD,CHOLMOD,COLAMD,KLU,LDL,UMFPACK,SPQR,RBio} Lib Include export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/metis" export LAPACK="" @@ -195,8 +198,13 @@ find */ -iname lesser.txt -o -iname lesserv3.txt -o -iname license.txt -o \ hardlink -cv Docs/ Licenses/ %check -export AUTOCC=no -export CC=gcc +%if "%toolchain" == "clang" + export CC=clang + export CXX=clang++ +%else + export AUTOCC=no + export CC=gcc +%endif TESTDIRS="AMD CAMD CCOLAMD CHOLMOD COLAMD KLU LDL SPQR RBio UMFPACK" TESTDIRS="$TESTDIRS CXSparse" export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/metis" @@ -220,6 +228,9 @@ done %doc Doc/* %changelog +* Tue Jul 25 2023 yoo - 5.10.1-3 +- fix clang build error + * Fri Mar 03 2023 Ge Wang - 5.10.1-2 - Remove rpath -- Gitee