From 6a16110d52e7c81c36b855f03167cc67f3f19de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E4=B8=8A=E9=93=9C=2010332738?= Date: Tue, 3 Jun 2025 15:56:30 +0800 Subject: [PATCH 1/3] fix atomic link error when build on riscv64 --- cmake.spec | 8 +++++++- fix_atomic_error_when_build_on_riscv64.patch | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 fix_atomic_error_when_build_on_riscv64.patch diff --git a/cmake.spec b/cmake.spec index cda75ac..44dcf51 100644 --- a/cmake.spec +++ b/cmake.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %bcond_with bootstrap %bcond_without emacs %bcond_without git_test @@ -36,6 +36,9 @@ Source4: %{name}.prov Source5: %{name}.req Patch100: %{name}-findruby.patch +%ifarch riscv64 +Patch200: fix_atomic_error_when_build_on_riscv64.patch +%endif BuildRequires: coreutils BuildRequires: findutils @@ -351,6 +354,9 @@ popd %{_rpmconfigdir}/%{name}.req %changelog +* Tue Jun 03 2025 Shangtong Guo - 3.30.3-2 +- fix atomic link error when build on riscv64 + * Thu Feb 27 2025 Zhao Hang - 3.30.5-1 - Update to 3.30.5-1 from 3.26.3-1 - Drop non-upstream CMAKE_DL_LIBS windows patch diff --git a/fix_atomic_error_when_build_on_riscv64.patch b/fix_atomic_error_when_build_on_riscv64.patch new file mode 100644 index 0000000..03ca6c6 --- /dev/null +++ b/fix_atomic_error_when_build_on_riscv64.patch @@ -0,0 +1,19 @@ +diff -ruN cmake-3.30.5/Modules/Platform/Linux.cmake cmake-3.30.5_bak/Modules/Platform/Linux.cmake +--- cmake-3.30.5/Modules/Platform/Linux.cmake 2024-10-08 08:56:04.000000000 -0400 ++++ cmake-3.30.5_bak/Modules/Platform/Linux.cmake 2025-05-29 19:57:52.565154600 -0400 +@@ -93,3 +93,15 @@ + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) + endif() + endif() ++ ++# RISCV needs -latomic ++# https://gitlab.kitware.com/cmake/cmake/-/issues/20895 ++# ++# Ideally I'd use CMAKE_C_COMPILER_ARCHITECTURE_ID, but that is only ++# available on Win platforms. Not sure why though, cause every ++# compiler on Linux has a default architecture it compiles for too, ++# when no flags are passed to ask the compiler to behave differently. ++if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") ++ string(APPEND CMAKE_C_STANDARD_LIBRARIES " -latomic") ++ string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -latomic") ++endif() -- Gitee From a0f3ccd37b5a31bde12db3697c4558ef963f117d Mon Sep 17 00:00:00 2001 From: Guost123 Date: Tue, 3 Jun 2025 20:18:06 +0800 Subject: [PATCH 2/3] fix atomic link error when build on riscv64 --- cmake.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake.spec b/cmake.spec index 44dcf51..32ff53c 100644 --- a/cmake.spec +++ b/cmake.spec @@ -217,7 +217,8 @@ $SRCDIR/bootstrap --prefix=%{_prefix} \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O2 -g -DNDEBUG" \ -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-O2 -g -DNDEBUG" \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ - -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF + -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \ + -DCMake_TEST_NO_NETWORK:BOOL=ON popd %make_build -C %{_vpath_builddir} @@ -297,6 +298,8 @@ NO_TEST="$NO_TEST|curl" %endif %ifarch riscv64 NO_TEST="$NO_TEST|Qt5Autogen.ManySources|Qt5Autogen.MocInclude|Qt5Autogen.MocIncludeSymlink" +NO_TEST="$NO_TEST|RunCMake.Make|RunCMake.BuildDepends|Qt6Autogen.RerunMocBasic|Qt6Autogen.RerunRccDepends" +NO_TEST="$NO_TEST|RunCMake.ExternalProject|CMakeLib.testUVProcessChain|ExportImport|CMakeOnly.AllFindModules|RunCMake.AutogenQt5|RunCMake.Byproducts|RunCMake.GenEx-LINK_LIBRARY|RunCMake.GenEx-LINK_GROUP|RunCMake.GoogleTest|RunCMake.Graphviz|RunCMake.ObjectLibrary|RunCMake.CompileFeatures|RunCMake.WriteBasicConfigVersionFile|RunCMake.MaxRecursionDepth|TryCompile|CPackTestAllGenerators" %endif bin/ctest%{?name_suffix} %{?_smp_mflags} -V -E "$NO_TEST" --output-on-failure popd -- Gitee From dc1d81873aa91aee8a1061b5daefffb6b1ceb971 Mon Sep 17 00:00:00 2001 From: Guost123 Date: Tue, 3 Jun 2025 20:20:33 +0800 Subject: [PATCH 3/3] fix atomic link error when build on riscv64 --- cmake.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake.spec b/cmake.spec index 32ff53c..dc0d848 100644 --- a/cmake.spec +++ b/cmake.spec @@ -36,9 +36,8 @@ Source4: %{name}.prov Source5: %{name}.req Patch100: %{name}-findruby.patch -%ifarch riscv64 + Patch200: fix_atomic_error_when_build_on_riscv64.patch -%endif BuildRequires: coreutils BuildRequires: findutils -- Gitee