!589 compile using c++17

* compile using c++17
This commit is contained in:
zhangxiaoyu 2023-08-03 09:52:10 +00:00 committed by haozi007
parent c34e22b8bc
commit 820d535805
2 changed files with 69 additions and 5 deletions

View File

@ -0,0 +1,54 @@
From 85f6947f9f0c3a5ac7f70250b5c80627f2d18949 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 1 Aug 2023 15:05:55 +0800
Subject: [PATCH] fix execlp not enough args
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
cmake/set_build_flags.cmake | 2 +-
test/fuzz/CMakeLists.txt | 2 +-
test/image/oci/oci_ut_common.cc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/set_build_flags.cmake b/cmake/set_build_flags.cmake
index ba250cd..09c85c6 100644
--- a/cmake/set_build_flags.cmake
+++ b/cmake/set_build_flags.cmake
@@ -3,7 +3,7 @@ set(CMAKE_C_FLAGS "-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -fP
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
if (GRPC_CONNECTOR)
- set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Wno-error=deprecated-declarations")
+ set(CMAKE_CXX_FLAGS "-fPIC -std=c++17 -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -Wno-error=deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
endif()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-E -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wtrampolines -shared -pthread")
diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt
index 478a401..617a168 100644
--- a/test/fuzz/CMakeLists.txt
+++ b/test/fuzz/CMakeLists.txt
@@ -34,7 +34,7 @@ MESSAGE(STATUS "GCLANG_PP_BINARY is set to ${GCLANG_PP_BINARY}")
SET(CMAKE_C_COMPILER "${GCLANG_BINARY}")
SET(CMAKE_CXX_COMPILER "${GCLANG_PP_BINARY}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fsanitize=fuzzer,address -fsanitize-coverage=indirect-calls,trace-cmp,trace-div,trace-gep")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage -std=c++11 -fsanitize=fuzzer,address -fsanitize-coverage=indirect-calls,trace-cmp,trace-div,trace-gep")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage -std=c++17 -fsanitize=fuzzer,address -fsanitize-coverage=indirect-calls,trace-cmp,trace-div,trace-gep")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
SET(EXE0 test_volume_mount_spec_fuzz)
diff --git a/test/image/oci/oci_ut_common.cc b/test/image/oci/oci_ut_common.cc
index 1158ae8..9fa25d1 100644
--- a/test/image/oci/oci_ut_common.cc
+++ b/test/image/oci/oci_ut_common.cc
@@ -22,7 +22,7 @@
int execvp_success(const char *file, char * const argv[])
{
- execlp("echo", "echo");
+ execlp("echo", "echo", NULL);
return -1;
}
--
2.25.1

View File

@ -1,8 +1,9 @@
%global _version 2.1.2 %global _version 2.1.2
%global _release 4 %global _release 5
%global is_systemd 1 %global is_systemd 1
%global enable_shimv2 1 %global enable_shimv2 1
%global is_embedded 1 %global is_embedded 1
%global cpp_std 17
Name: iSulad Name: iSulad
Version: %{_version} Version: %{_version}
@ -28,6 +29,7 @@ Patch0012: 0012-fix-hugetlbs-malloc-length.patch
Patch0013: 0013-fix-forget-to-set-return-value.patch Patch0013: 0013-fix-forget-to-set-return-value.patch
Patch0014: 0014-ensure-define-in-local-and-use-correctly-type.patch Patch0014: 0014-ensure-define-in-local-and-use-correctly-type.patch
Patch0015: 0015-Revert-the-changes-in-util_smart_calloc_s.patch Patch0015: 0015-Revert-the-changes-in-util_smart_calloc_s.patch
Patch0016: 0016-fix-execlp-not-enough-args.patch
%ifarch x86_64 aarch64 %ifarch x86_64 aarch64
Provides: libhttpclient.so()(64bit) Provides: libhttpclient.so()(64bit)
@ -67,6 +69,7 @@ BuildRequires: libcurl libcurl-devel libarchive-devel device-mapper-devel
BuildRequires: http-parser-devel BuildRequires: http-parser-devel
BuildRequires: libseccomp-devel libcap-devel libselinux-devel libwebsockets libwebsockets-devel BuildRequires: libseccomp-devel libcap-devel libselinux-devel libwebsockets libwebsockets-devel
BuildRequires: systemd-devel git BuildRequires: systemd-devel git
BuildRequires: libevhtp-devel libevent-devel
%if 0%{?enable_shimv2} %if 0%{?enable_shimv2}
BuildRequires: lib-shim-v2 lib-shim-v2-devel BuildRequires: lib-shim-v2 lib-shim-v2-devel
%endif %endif
@ -79,6 +82,7 @@ Requires: libcurl
Requires: http-parser libseccomp Requires: http-parser libseccomp
Requires: libcap libselinux libwebsockets libarchive device-mapper Requires: libcap libselinux libwebsockets libarchive device-mapper
Requires: systemd Requires: systemd
BuildRequires: libevhtp libevent
%if 0%{?enable_shimv2} %if 0%{?enable_shimv2}
Requires: lib-shim-v2 Requires: lib-shim-v2
%endif %endif
@ -95,15 +99,15 @@ mkdir -p build
cd build cd build
%if 0%{?enable_shimv2} %if 0%{?enable_shimv2}
%if %{defined openeuler} %if %{defined openeuler}
%cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_SHIM_V2=ON -DENABLE_UT=ON -DENABLE_GRPC_REMOTE_CONNECT=ON ../ %cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_SHIM_V2=ON -DENABLE_UT=OFF -DENABLE_GRPC_REMOTE_CONNECT=OFF -DENABLE_GRPC=OFF -DCMAKE_CXX_STANDARD=%{cpp_std} ../
%else %else
%cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_SHIM_V2=ON -DENABLE_GRPC_REMOTE_CONNECT=ON ../ %cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_SHIM_V2=ON -DENABLE_GRPC_REMOTE_CONNECT=OFF -DENABLE_GRPC=OFF -DCMAKE_CXX_STANDARD=%{cpp_std} ../
%endif %endif
%else %else
%if %{defined openeuler} %if %{defined openeuler}
%cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UT=ON -DENABLE_GRPC_REMOTE_CONNECT=ON ../ %cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UT=OFF -DENABLE_GRPC_REMOTE_CONNECT=OFF -DENABLE_GRPC=OFF -DCMAKE_CXX_STANDARD=%{cpp_std} ../
%else %else
%cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_GRPC_REMOTE_CONNECT=ON ../ %cmake -DDEBUG=ON -DCMAKE_SKIP_RPATH=TRUE -DLIB_INSTALL_DIR=%{_libdir} -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_GRPC_REMOTE_CONNECT=OFF -DENABLE_GRPC=OFF -DCMAKE_CXX_STANDARD=%{cpp_std} ../
%endif %endif
%endif %endif
%make_build %make_build
@ -270,6 +274,12 @@ fi
%endif %endif
%changelog %changelog
* Thu Jul 20 2023 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 2.1.2-5
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: compile using c++17
* Mon May 29 2023 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 2.1.2-4 * Mon May 29 2023 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 2.1.2-4
- Type: bugfix - Type: bugfix
- ID: NA - ID: NA