From 5c178fa366d45923d5c82d4e2db07fb665956a98 Mon Sep 17 00:00:00 2001 From: Cyber-SiKu Date: Wed, 31 Aug 2022 17:19:57 +0800 Subject: [PATCH] curve: fix build erro in debian11 Signed-off-by: Cyber-SiKu --- curvefs/src/client/fuse_s3_client.cpp | 2 +- curvefs/src/client/main.cpp | 1 + curvefs/util/build.sh | 2 +- ut.sh | 5 +++++ util/build.sh | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/curvefs/src/client/fuse_s3_client.cpp b/curvefs/src/client/fuse_s3_client.cpp index 86edc1889c..68dc384763 100644 --- a/curvefs/src/client/fuse_s3_client.cpp +++ b/curvefs/src/client/fuse_s3_client.cpp @@ -82,7 +82,7 @@ CURVEFS_ERROR FuseS3Client::Init(const FuseClientOption &option) { void FuseS3Client::GetWarmUpFileList(const WarmUpFileContext_t&warmUpFile, std::vector& warmUpFilelist) { - struct fuse_file_info fi; + struct fuse_file_info fi{}; fi.flags &= ~O_DIRECT; size_t rSize = 0; std::unique_ptr data(new char[warmUpFile.fileLen+1]); diff --git a/curvefs/src/client/main.cpp b/curvefs/src/client/main.cpp index 03e50e45d7..474fa71458 100644 --- a/curvefs/src/client/main.cpp +++ b/curvefs/src/client/main.cpp @@ -22,6 +22,7 @@ */ #include +#include #include "curvefs/src/client/curve_fuse_op.h" #include "curvefs/src/client/fuse_common.h" diff --git a/curvefs/util/build.sh b/curvefs/util/build.sh index 799231e2fd..36102728dc 100644 --- a/curvefs/util/build.sh +++ b/curvefs/util/build.sh @@ -157,7 +157,7 @@ build_target() { # set version g_build_opts+=("--copt -DCURVEVERSION=${curve_version}") - if [ "$g_os" == "debian10" -o "$g_os" == "debian11" ]; then + if [ `gcc -dumpversion | awk -F'.' '{print $1}'` -gt 6 ]; then g_build_opts+=("--config=gcc7-later") fi diff --git a/ut.sh b/ut.sh index 4b42d7fd94..452e3bacfd 100644 --- a/ut.sh +++ b/ut.sh @@ -86,6 +86,11 @@ fi set -e +################################################################ __GCC VERSION__ +if [ `gcc -dumpversion | awk -F'.' '{print $1}'` -gt 6 ]; then + g_build_opts+=("--config=gcc7-later") +fi + bazel build ... -c dbg --collect_code_coverage --copt -DHAVE_ZLIB=1 --define=with_glog=true --define=libunwind=true --copt -DGFLAGS_NS=google --copt -Wno-error=format-security --copt -DUSE_BTHREAD_MUTEX ${g_build_opts[@]} #test_bin_dirs="bazel-bin/test/ bazel-bin/nebd/test/ bazel-bin/curvefs/test/" diff --git a/util/build.sh b/util/build.sh index 4655a00f75..85b171c1cd 100644 --- a/util/build.sh +++ b/util/build.sh @@ -137,7 +137,7 @@ build_target() { fi g_build_opts+=("--copt -DCURVEVERSION=${version}") - if [ "$g_os" == "debian10" -o "$g_os" == "debian11" ]; then + if [ `gcc -dumpversion | awk -F'.' '{print $1}'` -gt 6 ]; then g_build_opts+=("--config=gcc7-later") fi