Skip to content

Commit

Permalink
build: Workaround for rocksdb compiling errors
Browse files Browse the repository at this point in the history
When compiling cubefs using a newer version gcc (version 10.2.1), it
complains that:

./db/version_edit.h:156:33: error: implicitly-declared ‘constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)’ is deprecated [-Werror=deprecated-copy]
   76 | struct FileMetaData {
      |        ^~~~~~~~~~~~

./memtable/inlineskiplist.h:282:11: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct std::atomic<rocksdb::InlineSkipList<const rocksdb::MemTableRep::KeyComparator&>::Node*>’ with no trivial copy-assignment [-Werror=class-memaccess]
  282 |     memcpy(&next_[0], &height, sizeof(int));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

./utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
   51 |     return std::move(t);
      |                       ^

The best way to address that is to backport patches or upgrade
rocksdb. However this is a big move for cubefs. So let's just
switch these errors off temporarily to make gcc happy.

Reference: facebook/rocksdb#5303

Signed-off-by: Sheng Yong <[email protected]>
  • Loading branch information
shyodx committed Feb 8, 2022
1 parent 2970e2c commit 0028405
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ build_rocksdb() {
echo "build rocksdb..."
pushd ${RocksdbBuildPath} >/dev/null
[ "-$LUA_PATH" != "-" ] && unset LUA_PATH
make -j ${NPROC} static_lib && echo "build rocksdb success" || { echo "build rocksdb failed" ; exit 1; }
CXXFLAGS='-Wno-error=deprecated-copy -Wno-error=class-memaccess -Wno-error=pessimizing-move' \
make -j ${NPROC} static_lib && echo "build rocksdb success" || { echo "build rocksdb failed" ; exit 1; }
popd >/dev/null
fi
cgo_cflags="${cgo_cflags} -I${RocksdbSrcPath}/include"
Expand Down

0 comments on commit 0028405

Please sign in to comment.