From ada92e3becad3670d851c0d4010c96220022c837 Mon Sep 17 00:00:00 2001 From: laokz Date: Sun, 2 Jul 2023 17:27:24 +0800 Subject: [PATCH] add -latomic flag to lockfree tests for riscv64 Boost does not implement atomic functions for RISC-V, and depend that on compiler. For 16-byte atomic ops, the compiler must link against libatomic. (cherry picked from commit 28c9b15a369dd6652596c8b10f56ff57d6d4ada9) --- boost.spec | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/boost.spec b/boost.spec index ee7dbe8..999fea0 100644 --- a/boost.spec +++ b/boost.spec @@ -2,7 +2,7 @@ Name: boost Version: 1.78.0 -Release: 16 +Release: 17 Summary: The free peer-reviewed portable C++ source libraries License: Boost Software License 1.0 URL: http://www.boost.org @@ -74,6 +74,9 @@ BuildRequires: libquadmath-devel libquadmath-static BuildRequires: python3-numpy # optional library for regex BuildRequires: libicu-devel +%ifarch riscv64 +BuildRequires: libatomic +%endif Obsoletes: boost-signals < 1.69.0 @@ -301,7 +304,12 @@ cd status ../b2 %{?_smp_mflags} %{opt_feature} cxxflags="$RPM_OPT_FLAGS" %{boost_macros} \ --include-tests=algorithm,graph,intrusive,dynamic_bitset,property_map,crc,lexical_cast,range \ --exclude-tests=mpi,graph_parallel -../b2 %{?_smp_mflags} %{opt_feature} cxxflags="$RPM_OPT_FLAGS" %{boost_macros} \ +%ifarch riscv64 +LINKFLAGS='linkflags="-Wl,-latomic"' +%else +LINKFLAGS= +%endif +../b2 %{?_smp_mflags} %{opt_feature} cxxflags="$RPM_OPT_FLAGS" $LINKFLAGS %{boost_macros} \ --include-tests=bimap,circular_buffer,container,heap,icl,lockfree,logic,multi_array,multi_index,poly_collection,property_tree,ptr_container,sort \ --exclude-tests=container_hash @@ -453,6 +461,9 @@ find libs -name example -exec cp {} boost-example --parents -r \; %{_libdir}/*.a %changelog +* Mon Aug 14 2023 laokz - 1.78.0-17 +- add -latomic flag to lockfree tests for riscv64 + * Thu Aug 10 2023 herengui - 1.78.0-16 - add loongarch64 patch -- Gitee