From c4f51c85df3ba2b20572159f4ebdacb29fe3d6ff Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 18 Apr 2018 11:08:44 +0800 Subject: [PATCH 1/4] common: silence GCC warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preforker.h:111:8: warning: ignoring return value of ‘ssize_t safe_write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] (void)safe_write(fd[1], &r, sizeof(r)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and compat.cc:36:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (off + sizeof(data) > len) ~~~~~~~~~~~~~~~~~~~^~~~~ Fixes: http://tracker.ceph.com/issues/23774 Signed-off-by: Kefu Chai --- src/common/Preforker.h | 2 +- src/common/compat.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/Preforker.h b/src/common/Preforker.h index f6671a5d302..8925d944daa 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -108,7 +108,7 @@ public: int signal_exit(int r) { if (forked) { /* If we get an error here, it's too late to do anything reasonable about it. */ - (void)safe_write(fd[1], &r, sizeof(r)); + [[maybe_unused]] auto n = safe_write(fd[1], &r, sizeof(r)); } return r; } diff --git a/src/common/compat.cc b/src/common/compat.cc index 18b75874ad0..66f6e7e8f6b 100644 --- a/src/common/compat.cc +++ b/src/common/compat.cc @@ -33,7 +33,7 @@ int manual_fallocate(int fd, off_t offset, off_t len) { // TODO: compressing filesystems would require random data memset(data, 0x42, sizeof(data)); for (off_t off = 0; off < len; off += sizeof(data)) { - if (off + sizeof(data) > len) + if (off + static_cast(sizeof(data)) > len) r = safe_write(fd, data, len - off); else r = safe_write(fd, data, sizeof(data)); From 750c301e1c3c446981a69431bb18ef249048edd9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 18 Apr 2018 11:53:24 +0800 Subject: [PATCH 2/4] cmake: use CMP0028 NEW it's intended behavior to use imported or alias target for dependencies with name with "::" in it. Signed-off-by: Kefu Chai --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc4cb19bce0..0d7a6996980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 2.8.12) project(ceph CXX C ASM) set(VERSION 13.0.2) +if(POLICY CMP0028) + cmake_policy(SET CMP0028 NEW) +endif() if(POLICY CMP0046) # Tweak policies (this one disables "missing" dependency warning) cmake_policy(SET CMP0046 OLD) From 19aee456c0db78760c6c003f3e69c10629220ac7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 18 Apr 2018 12:26:02 +0800 Subject: [PATCH 3/4] cmake,make-dist: use sha256 instead of md5 for checksum the boost's download page offers the SHA256 hash, so it'd be easier to verify the hash this way. Signed-off-by: Kefu Chai --- cmake/modules/BuildBoost.cmake | 4 ++-- make-dist | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake index 1bc28ad0f82..90fac55370d 100644 --- a/cmake/modules/BuildBoost.cmake +++ b/cmake/modules/BuildBoost.cmake @@ -140,7 +140,7 @@ function(do_build_boost version) # NOTE: If you change this version number make sure the package is available # at the three URLs below (may involve uploading to download.ceph.com) set(boost_version 1.66.0) - set(boost_md5 b2dfbd6c717be4a7bb2d88018eaccf75) + set(boost_256 5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9) string(REPLACE "." "_" boost_version_underscore ${boost_version} ) set(boost_url https://dl.bintray.com/boostorg/release/${boost_version}/source/boost_${boost_version_underscore}.tar.bz2) @@ -152,7 +152,7 @@ function(do_build_boost version) endif() set(source_dir URL ${boost_url} - URL_MD5 ${boost_md5}) + URL_HASH SHA256=${boost_sha256}) if(CMAKE_VERSION VERSION_GREATER 3.1) list(APPEND source_dir DOWNLOAD_NO_PROGRESS 1) endif() diff --git a/make-dist b/make-dist index 29493b1ffc4..b0083882fce 100755 --- a/make-dist +++ b/make-dist @@ -23,7 +23,7 @@ fi download_boost() { boost_version=$1 shift - boost_md5=$1 + boost_sha256=$1 shift boost_version_underscore=$(echo $boost_version | sed 's/\./_/g') boost_fname=boost_${boost_version_underscore}.tar.bz2 @@ -39,8 +39,8 @@ download_boost() { wget -c --no-verbose -O $boost_fname $url if [ $? != 0 -o ! -e $boost_fname ]; then echo "Download of $url failed" - elif [ $(md5sum $boost_fname | awk '{print $1}') != $boost_md5 ]; then - echo "Error: failed to download boost: MD5 mismatch." + elif [ $(sha256sum $boost_fname | awk '{print $1}') != $boost_sha256 ]; then + echo "Error: failed to download boost: SHA256 mismatch." else break fi @@ -131,7 +131,7 @@ tar cvf $outfile.version.tar $outfile/src/.git_version $outfile/ceph.spec $outfi # NOTE: If you change this version number make sure the package is available # at the three URLs referenced below (may involve uploading to download.ceph.com) boost_version=1.66.0 -download_boost $boost_version b2dfbd6c717be4a7bb2d88018eaccf75 \ +download_boost $boost_version 5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9 \ https://dl.bintray.com/boostorg/release/$boost_version/source \ https://downloads.sourceforge.net/project/boost/boost/$boost_version \ https://download.ceph.com/qa From 3178bb963886f94411c0e90fb5c4ad93a0ea775b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 18 Apr 2018 15:05:45 +0800 Subject: [PATCH 4/4] cmake: disable gflags support in rocksdb to silence the warnings like CMake Warning at CMakeLists.txt:73 (find_package): By not providing "Findgflags.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "gflags", but CMake did not find one. Could not find a package configuration file provided by "gflags" with any of the following names: gflagsConfig.cmake gflags-config.cmake Add the installation prefix of "gflags" to CMAKE_PREFIX_PATH or set "gflags_DIR" to a directory containing one of the above files. If "gflags" provides a separate development package or SDK, be sure it has been installed. Signed-off-by: Kefu Chai --- cmake/modules/BuildRocksDB.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/modules/BuildRocksDB.cmake b/cmake/modules/BuildRocksDB.cmake index 8e0ad577887..10dfc1b3c6b 100644 --- a/cmake/modules/BuildRocksDB.cmake +++ b/cmake/modules/BuildRocksDB.cmake @@ -1,7 +1,8 @@ include(CheckCXXSourceRuns) function(do_build_rocksdb) - set(ROCKSDB_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON) + set(ROCKSDB_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON) + list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_GFLAGS=OFF) if(ALLOCATOR STREQUAL "jemalloc") list(APPEND ROCKSDB_CMAKE_ARGS -DWITH_JEMALLOC=ON)