From 2d9f44816d6257b162eeef4e305e702381b6c226 Mon Sep 17 00:00:00 2001 From: s Date: Thu, 25 May 2023 22:57:43 +0800 Subject: [PATCH] fix clang build error Signed-off-by: shafeipaozi --- fix-clang.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ iSulad.spec | 11 ++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 fix-clang.patch diff --git a/fix-clang.patch b/fix-clang.patch new file mode 100644 index 0000000..bc958b0 --- /dev/null +++ b/fix-clang.patch @@ -0,0 +1,61 @@ +diff -u -r iSulad-v2.1.1/src/daemon/entry/cri/cri_container_manager_service.cc iSulad-v2.1.1/src/daemon/entry/cri/cri_container_manager_service.cc +--- iSulad-v2.1.1/src/daemon/entry/cri/cri_container_manager_service.cc 2023-02-06 19:06:11.000000000 +0800 ++++ iSulad-v2.1.1/src/daemon/entry/cri/cri_container_manager_service.cc 2023-05-25 19:52:33.000000000 +0800 +@@ -650,7 +650,7 @@ + CRIHelpers::ContainerStatusToRuntime(Container_Status(response->containers[i]->status)); + container->set_state(state); + +- pods->push_back(move(container)); ++ pods->push_back(std::move(container)); + } + } + +diff -u -r iSulad-v2.1.1/src/daemon/entry/cri/cri_image_manager_service_impl.cc iSulad-v2.1.1/src/daemon/entry/cri/cri_image_manager_service_impl.cc +--- iSulad-v2.1.1/src/daemon/entry/cri/cri_image_manager_service_impl.cc 2023-02-06 19:06:11.000000000 +0800 ++++ iSulad-v2.1.1/src/daemon/entry/cri/cri_image_manager_service_impl.cc 2023-05-25 19:53:01.000000000 +0800 +@@ -150,7 +150,7 @@ + + imagetool_image_summary *element = list_images->images[i]; + conv_image_to_grpc(element, image); +- images->push_back(move(image)); ++ images->push_back(std::move(image)); + } + } + +diff -u -r iSulad-v2.1.1/test/cutils/utils_aes/utils_aes_ut.cc iSulad-v2.1.1/test/cutils/utils_aes/utils_aes_ut.cc +--- iSulad-v2.1.1/test/cutils/utils_aes/utils_aes_ut.cc 2023-02-06 19:06:11.000000000 +0800 ++++ iSulad-v2.1.1/test/cutils/utils_aes/utils_aes_ut.cc 2023-05-20 01:21:33.000000000 +0800 +@@ -19,7 +19,7 @@ + TEST(utils_aes, test_util_aes_key) + { + std::string key_file = "./aes_key"; +- unsigned char key_val[AES_256_CFB_KEY_LEN] = { 0 }; ++ unsigned char key_val[AES_256_CFB_KEY_LEN + 1] = { 0 }; + + unlink(key_file.c_str()); + ASSERT_NE(util_aes_key(key_file.c_str(), false, key_val), 0); +@@ -34,7 +34,7 @@ + TEST(utils_aes, test_util_aes_encode) + { + std::string key_file = "./aes_key"; +- unsigned char key_val[AES_256_CFB_KEY_LEN] = { 0 }; ++ unsigned char key_val[AES_256_CFB_KEY_LEN + 1] = { 0 }; + std::string test_data = "hello world"; + unsigned char *out = nullptr; + +@@ -52,7 +52,7 @@ + TEST(utils_aes, test_util_aes_decode) + { + std::string key_file = "./aes_key"; +- unsigned char key_val[AES_256_CFB_KEY_LEN] = { 0 }; ++ unsigned char key_val[AES_256_CFB_KEY_LEN + 1] = { 0 }; + std::string test_data = "hello world"; + unsigned char *encode_data = nullptr; + unsigned char *decode_data = nullptr; +@@ -71,4 +71,4 @@ + ASSERT_NE(util_aes_decode(key_val, encode_data, aes_len, nullptr), 0); + + unlink(key_file.c_str()); +-} +\ No newline at end of file ++} diff --git a/iSulad.spec b/iSulad.spec index 4de13be..16ed765 100644 --- a/iSulad.spec +++ b/iSulad.spec @@ -1,5 +1,5 @@ %global _version 2.1.5 -%global _release 2 +%global _release 3 %global is_systemd 1 %global enable_criv1 1 %global enable_shimv2 1 @@ -41,6 +41,7 @@ Patch0023: 0023-add-benchmark-result-of-perf-test-in-cri.patch Patch0024: 0024-add-support-for-systemd-cgroup-driver.patch Patch0025: 0025-add-ci-cases-for-systemd-cgroup-driver.patch Patch0026: 0026-move-systemd_cgroup-CI-test-to-manual-cases.patch +Patch0027: fix-clang.patch %ifarch x86_64 aarch64 Provides: libhttpclient.so()(64bit) @@ -103,6 +104,10 @@ Runtime Daemon, written by C. %autosetup -n iSulad-v%{_version} -Sgit -p1 %build +%if "%{?toolchain}" == "clang" + export CFLAGS="$CFLAGS -Wno-error=unused-variable" + export CXXFLAGS="$CXXFLAGS -Wno-error=unused-variable" +%endif mkdir -p build cd build %cmake \ @@ -295,6 +300,10 @@ fi %endif %changelog +* Wed Mar 20 2024 yoo - %{_version}-%{_release} +- fix clang build error +- Signed-off-by: shafeipaozi + * Tue Mar 19 2024 zhongtao - 2.1.5-2 - Type: update - ID: NA -- Gitee