From 2d14722291edb8a13c6280ff15120ed16b792240 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Thu, 1 Dec 2022 09:42:04 +0800 Subject: [PATCH] fix build error for loongarch64 --- 0001-modify-the-ABI-for-loongarch.patch | 43 +++++++++++++++++++++++++ openblas.spec | 12 +++++-- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 0001-modify-the-ABI-for-loongarch.patch diff --git a/0001-modify-the-ABI-for-loongarch.patch b/0001-modify-the-ABI-for-loongarch.patch new file mode 100644 index 0000000..fdf06c6 --- /dev/null +++ b/0001-modify-the-ABI-for-loongarch.patch @@ -0,0 +1,43 @@ +From 15f793d0d1a38f1e203d7d50df3947201731c34d Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Wed, 30 Nov 2022 09:27:01 +0000 +Subject: [PATCH] modify the ABI for loongarch + +--- + OpenBLAS-0.3.18/Makefile.system | 4 ++-- + OpenBLAS-0.3.18/Makefile.system.libname | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git OpenBLAS-0.3.18/Makefile.system OpenBLAS-0.3.18/Makefile.system +index 17310b0..19f04b5 100644 +--- OpenBLAS-0.3.18/Makefile.system ++++ OpenBLAS-0.3.18/Makefile.system +@@ -869,8 +869,8 @@ endif + + ifeq ($(ARCH), loongarch64) + ifeq ($(CORE), LOONGSON3R5) +-CCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-FCOMMON_OPT += -march=loongarch64 -mabi=lp64 ++CCOMMON_OPT += -march=loongarch64 -mabi=lp64d ++FCOMMON_OPT += -march=loongarch64 -mabi=lp64d + endif + endif + +diff --git OpenBLAS-0.3.18/Makefile.system.libname OpenBLAS-0.3.18/Makefile.system.libname +index 150dbef..f9101af 100644 +--- OpenBLAS-0.3.18/Makefile.system.libname ++++ OpenBLAS-0.3.18/Makefile.system.libname +@@ -869,8 +869,8 @@ endif + + ifeq ($(ARCH), loongarch64) + ifeq ($(CORE), LOONGSON3R5) +-CCOMMON_OPT += -march=loongarch64 -mabi=lp64 +-FCOMMON_OPT += -march=loongarch64 -mabi=lp64 ++CCOMMON_OPT += -march=loongarch64 -mabi=lp64d ++FCOMMON_OPT += -march=loongarch64 -mabi=lp64d + endif + endif + +-- +2.33.0 + diff --git a/openblas.spec b/openblas.spec index 10b8bca..2356f3c 100644 --- a/openblas.spec +++ b/openblas.spec @@ -2,7 +2,7 @@ Name: openblas Version: 0.3.18 -Release: 4 +Release: 5 Summary: An optimized BLAS library based on GotoBLAS2 1.13 BSD version License: BSD URL: https://github.com/xianyi/OpenBLAS/ @@ -11,6 +11,7 @@ Patch0000: openblas-0.2.15-system_lapack.patch Patch0001: openblas-0.2.5-libname.patch Patch0002: openblas-0.3.7-tests.patch Patch0003: rm-make-test-from-Makefile-and-add-this-to-spec-in-f.patch +Patch0004: 0001-modify-the-ABI-for-loongarch.patch Requires: %{name}-devel = %{version}-%{release} BuildRequires: gcc gcc-gfortran perl-devel gcc-c++ @@ -48,7 +49,7 @@ Obsoletes: openblas-serial64_ < %{version}-%{release} openblas-openmp64_ < Obsoletes: openblas-threads64_ < %{version}-%{release} openblas-Rblas < %{version}-%{release} %endif -ExclusiveArch: x86_64 aarch64 +ExclusiveArch: x86_64 aarch64 loongarch64 %description OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD \ @@ -72,6 +73,7 @@ cd OpenBLAS-%{version} %patch0001 -p1 -b .libname %patch0002 -p1 -b .tests %patch0003 -p1 +%patch0004 -p1 # Set source permissions find -name \*.f -exec chmod 644 {} \; @@ -277,6 +279,9 @@ cp -a %{_includedir}/lapacke %{buildroot}%{_includedir}/%{name} %ifarch aarch64 suffix="_armv8" %endif +%ifarch loongarch64 +suffix="_loongson3r5" +%endif slibname=`basename %{buildroot}%{_libdir}/libopenblas${suffix}-*.so .so` mv %{buildroot}%{_libdir}/${slibname}.a %{buildroot}%{_libdir}/lib%{name}.a if [[ "$suffix" != "" ]]; then @@ -420,6 +425,9 @@ rm -rf %{buildroot}%{_libdir}/pkgconfig %endif %changelog +* Thu Dec 1 2022 Wenlong Zhang - 0.3.18-5 +- fix build error for loongarch64 + * Mon Apr 18 2022 zhouwenpei - 0.3.18-4 - sync master build speed optimization -- Gitee