diff options
Diffstat (limited to 'meta-oe/recipes-dbs/rocksdb')
14 files changed, 466 insertions, 243 deletions
diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-CMake-has-stock-FindZLIB-in-upper-case.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-CMake-has-stock-FindZLIB-in-upper-case.patch deleted file mode 100644 index 9682f8ad40..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-CMake-has-stock-FindZLIB-in-upper-case.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 38146a5d803a1fb9b10f011aa857872b6f20cd02 Mon Sep 17 00:00:00 2001 -From: Tongliang Liao <xkszltl@gmail.com> -Date: Mon, 29 Apr 2019 03:51:51 -0700 -Subject: [PATCH] CMake has stock FindZLIB in upper case. More details in - https://cmake.org/cmake/help/v3.14/module/FindZLIB.html - - -Upstream-Status: Backport https://github.com/facebook/rocksdb/pull/5261 - ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 40cdd26bb..355686566 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -92,7 +92,7 @@ else() - endif() - - if(WITH_ZLIB) -- find_package(zlib REQUIRED) -+ find_package(ZLIB REQUIRED) - add_definitions(-DZLIB) - if(ZLIB_INCLUDE_DIRS) - # CMake 3 --- -2.11.0 - diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-Disable-Wshadow-and-do-not-mark-default-copy-constru.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-Disable-Wshadow-and-do-not-mark-default-copy-constru.patch deleted file mode 100644 index eccaa3a37a..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-Disable-Wshadow-and-do-not-mark-default-copy-constru.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ee728434124b9b7d17abbd060a62aac79a9b79c0 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 12 Feb 2019 14:31:24 -0800 -Subject: [PATCH] Disable -Wshadow and do not mark default copy constructors - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - CMakeLists.txt | 2 +- - utilities/persistent_cache/block_cache_tier.h | 4 ++-- - utilities/persistent_cache/block_cache_tier_file.h | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 98e2e1973..3a24a075b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -254,7 +254,7 @@ if(FAIL_ON_WARNINGS) - if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") - else() # assume GCC -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow") - endif() - endif() - -diff --git a/utilities/persistent_cache/block_cache_tier.h b/utilities/persistent_cache/block_cache_tier.h -index 2b2c0ef4f..96d0540a4 100644 ---- a/utilities/persistent_cache/block_cache_tier.h -+++ b/utilities/persistent_cache/block_cache_tier.h -@@ -91,9 +91,9 @@ class BlockCacheTier : public PersistentCacheTier { - : key_(std::move(key)), data_(data) {} - ~InsertOp() {} - -- InsertOp() = delete; -+ InsertOp() = default; - InsertOp(InsertOp&& /*rhs*/) = default; -- InsertOp& operator=(InsertOp&& rhs) = default; -+ InsertOp& operator=(InsertOp&& rhs) = delete; - - // used for estimating size by bounded queue - size_t Size() { return data_.size() + key_.size(); } -diff --git a/utilities/persistent_cache/block_cache_tier_file.h b/utilities/persistent_cache/block_cache_tier_file.h -index e38b6c9a1..d9b89a4f7 100644 ---- a/utilities/persistent_cache/block_cache_tier_file.h -+++ b/utilities/persistent_cache/block_cache_tier_file.h -@@ -262,7 +262,7 @@ class ThreadedWriter : public Writer { - : file_(file), buf_(buf), file_off_(file_off), callback_(callback) {} - - IO(const IO&) = default; -- IO& operator=(const IO&) = default; -+ IO& operator=(const IO&) = delete; - size_t Size() const { return sizeof(IO); } - - WritableFile* file_ = nullptr; // File to write to --- -2.20.1 - diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch new file mode 100644 index 0000000000..ba6a2d4fbb --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch @@ -0,0 +1,123 @@ +From 034a9c4ce2ae61cfcffa977f1eb8e6f68947f480 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 18 Mar 2020 15:10:37 -0700 +Subject: [PATCH] cmake: Add check for atomic support + +Detect if libatomic should be linked in or compiler and platform can +provide the needed atomic instrinsics, this helps build on certain +platforms like mips or clang/i386 + +Fixes + +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_exchange_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_fetch_or_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_compare_exchange_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_fetch_sub_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_load_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_store_8' +| /mnt/b/yoe/build/tmp/work/mips32r2-yoe-linux/rocksdb/6.6.4-r0/recipe-sysroot-native/usr/bin/mips-yoe-linux/mips-yoe-linux-ld: librocksdb.so.6.6.4: undefined reference to `__atomic_fetch_add_8' + +Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/6555] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + CMakeLists.txt | 5 +++ + cmake/modules/CheckAtomic.cmake | 69 +++++++++++++++++++++++++++++++++ + 2 files changed, 74 insertions(+) + create mode 100644 cmake/modules/CheckAtomic.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cfc1b4803..0a7f820a22 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1038,7 +1038,12 @@ set(ROCKSDB_SHARED_LIB rocksdb-shared${ARTIFACT_SUFFIX}) + if(WIN32) + set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib) + else() ++ # check if linking against libatomic is necessary ++ include(CheckAtomic) + set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT}) ++ if(HAVE_CXX_ATOMIC_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) ++ set(SYSTEM_LIBS ${SYSTEM_LIBS} atomic) ++ endif() + endif() + + set(ROCKSDB_PLUGIN_EXTERNS "") +diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake +new file mode 100644 +index 0000000000..8b7dc8a377 +--- /dev/null ++++ b/cmake/modules/CheckAtomic.cmake +@@ -0,0 +1,69 @@ ++# Checks if atomic operations are supported natively or if linking against ++# libatomic is needed. ++ ++# Check inspired by LLVMs cmake/modules/CheckAtomic.cmake ++ ++INCLUDE(CheckCXXSourceCompiles) ++INCLUDE(CheckLibraryExists) ++ ++function(check_working_cxx_atomics varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++std::atomic<int> x; ++int main() { ++ return x; ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics) ++ ++function(check_working_cxx_atomics64 varname) ++ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) ++ set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}") ++ CHECK_CXX_SOURCE_COMPILES(" ++#include <atomic> ++#include <cstdint> ++std::atomic<uint64_t> x (0); ++std::atomic<double> y (0); ++int main() { ++ uint64_t i = x.load(std::memory_order_relaxed); ++ return int(y); ++} ++" ${varname}) ++ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) ++endfunction(check_working_cxx_atomics64) ++ ++# Check if atomics work without libatomic ++check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ ++if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) ++ if( HAVE_LIBATOMIC ) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++endif() ++ ++# Check if 64bit atomics work without libatomic ++check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ ++if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) ++ check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64) ++ if(HAVE_CXX_LIBATOMICS64) ++ list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") ++ check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB) ++ if (NOT HAVE_CXX_ATOMICS64_WITH_LIB) ++ message(FATAL_ERROR "Host compiler must support std::atomic!") ++ endif() ++ else() ++ message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.") ++ endif() ++endif() ++ +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-fix-Issue-5303.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-fix-Issue-5303.patch deleted file mode 100644 index ba9834dfef..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-fix-Issue-5303.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 512aaf3d833973f6146c6f1235b590901876175e Mon Sep 17 00:00:00 2001 -From: biocodz <biocodz@protonmail.com> -Date: Fri, 7 Jun 2019 09:49:37 -0400 -Subject: [PATCH] fix Issue 5303 - -Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/5426] - ---- - db/internal_stats.h | 21 +++++++++++++++++++++ - db/version_edit.h | 8 ++++++++ - utilities/persistent_cache/persistent_cache_util.h | 2 +- - 3 files changed, 30 insertions(+), 1 deletion(-) - -diff --git a/db/internal_stats.h b/db/internal_stats.h -index 6fa8727a4..09447644d 100644 ---- a/db/internal_stats.h -+++ b/db/internal_stats.h -@@ -236,6 +236,27 @@ class InternalStats { - } - } - -+ CompactionStats & operator=(const CompactionStats& c) { -+ count = c.count; -+ micros = c.micros; -+ cpu_micros = c.cpu_micros; -+ bytes_read_non_output_levels = c.bytes_read_non_output_levels; -+ bytes_read_output_level = c.bytes_read_output_level; -+ bytes_written = c.bytes_written; -+ bytes_moved = c.bytes_moved; -+ num_input_files_in_non_output_levels = -+ c.num_input_files_in_non_output_levels; -+ num_input_files_in_output_level = c.num_input_files_in_output_level; -+ num_output_files = c.num_output_files; -+ num_input_records = c.num_input_records; -+ num_dropped_records = c.num_dropped_records; -+ int num_of_reasons = static_cast<int>(CompactionReason::kNumOfReasons); -+ for (int i = 0; i < num_of_reasons; i++) { -+ counts[i] = c.counts[i]; -+ } -+ return *this; -+ } -+ - void Clear() { - this->micros = 0; - this->cpu_micros = 0; -diff --git a/db/version_edit.h b/db/version_edit.h -index 229531792..5c50ef552 100644 ---- a/db/version_edit.h -+++ b/db/version_edit.h -@@ -52,6 +52,14 @@ struct FileDescriptor { - smallest_seqno(_smallest_seqno), - largest_seqno(_largest_seqno) {} - -+ FileDescriptor(const FileDescriptor& fd) { -+ table_reader = fd.table_reader; -+ packed_number_and_path_id = fd.packed_number_and_path_id; -+ file_size = fd.file_size; -+ smallest_seqno = fd.smallest_seqno; -+ largest_seqno = fd.largest_seqno; -+ } -+ - FileDescriptor& operator=(const FileDescriptor& fd) { - table_reader = fd.table_reader; - packed_number_and_path_id = fd.packed_number_and_path_id; -diff --git a/utilities/persistent_cache/persistent_cache_util.h b/utilities/persistent_cache/persistent_cache_util.h -index 214bb5875..254c038f9 100644 ---- a/utilities/persistent_cache/persistent_cache_util.h -+++ b/utilities/persistent_cache/persistent_cache_util.h -@@ -48,7 +48,7 @@ class BoundedQueue { - T t = std::move(q_.front()); - size_ -= t.Size(); - q_.pop_front(); -- return std::move(t); -+ return t; - } - - size_t Size() const { --- -2.11.0 - diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch new file mode 100644 index 0000000000..342964cf2c --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch @@ -0,0 +1,66 @@ +From 1ba84e1b8d4c9a3ad85dc443b0df4d79c89cca4b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 17 Jun 2021 19:35:01 -0700 +Subject: [PATCH] replace old sync with new atomic builtin equivalents + +Helps compiling with gcc on newer arches e.g. riscv32 where these +__sync* builtins are not implemented atleast for 64bit values + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../range/range_tree/lib/portability/toku_atomic.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +index aaa2298faf..9385902808 100644 +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +@@ -77,37 +77,37 @@ template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_fetch_and_add(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_fetch_and_add(addr, diff); ++ return __atomic_fetch_add(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_add_and_fetch(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_add_and_fetch(addr, diff); ++ return __atomic_add_fetch(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_fetch_and_sub(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_fetch_and_sub(addr, diff); ++ return __atomic_fetch_sub(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_sub_and_fetch(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_sub_and_fetch(addr, diff); ++ return __atomic_sub_fetch(addr, diff, 5); + } + template <typename T, typename U, typename V> + __attribute__((always_inline)) static inline T toku_sync_val_compare_and_swap( + T *addr, U oldval, V newval) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_val_compare_and_swap(addr, oldval, newval); ++ return __atomic_compare_exchange(addr, oldval, newval); + } + template <typename T, typename U, typename V> + __attribute__((always_inline)) static inline bool + toku_sync_bool_compare_and_swap(T *addr, U oldval, V newval) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_bool_compare_and_swap(addr, oldval, newval); ++ return static_cast<bool>(__atomic_compare_exchange(addr, oldval, newval)); + } + + // in case you include this but not toku_portability.h +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-utilities-Fix-build-failure-with-Werror-maybe-uninit.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-utilities-Fix-build-failure-with-Werror-maybe-uninit.patch deleted file mode 100644 index ef0429a3c8..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/files/0001-utilities-Fix-build-failure-with-Werror-maybe-uninit.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 8996f075e64da0e6ffeda57632ef31f8710defcc Mon Sep 17 00:00:00 2001 -From: He Zhe <zhe.he@windriver.com> -Date: Fri, 15 Mar 2019 16:47:03 +0800 -Subject: [PATCH] utilities: Fix build failure with -Werror=maybe-uninitialized - -Summary: -Initialize magic_number to zero to avoid such failure. -utilities/blob_db/blob_log_format.cc:91:3: error: 'magic_number' may be used -uninitialized in this function [-Werror=maybe-uninitialized] - if (magic_number != kMagicNumber) { - ^~ - -Upstream-Status: Accepted [expected version 5.19] - -Signed-off-by: He Zhe <zhe.he@windriver.com> ---- - utilities/blob_db/blob_log_format.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/utilities/blob_db/blob_log_format.cc b/utilities/blob_db/blob_log_format.cc -index 2bf7028..8726cb8 100644 ---- a/utilities/blob_db/blob_log_format.cc -+++ b/utilities/blob_db/blob_log_format.cc -@@ -82,7 +82,7 @@ Status BlobLogFooter::DecodeFrom(Slice src) { - uint32_t src_crc = 0; - src_crc = crc32c::Value(src.data(), BlobLogFooter::kSize - sizeof(uint32_t)); - src_crc = crc32c::Mask(src_crc); -- uint32_t magic_number; -+ uint32_t magic_number = 0; - if (!GetFixed32(&src, &magic_number) || !GetFixed64(&src, &blob_count) || - !GetFixed64(&src, &expiration_range.first) || - !GetFixed64(&src, &expiration_range.second) || !GetFixed32(&src, &crc)) { --- -2.7.4 - diff --git a/meta-oe/recipes-dbs/rocksdb/files/0002-cmake-Use-exported-target-for-bz2.patch b/meta-oe/recipes-dbs/rocksdb/files/0002-cmake-Use-exported-target-for-bz2.patch new file mode 100644 index 0000000000..6b46a1f300 --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0002-cmake-Use-exported-target-for-bz2.patch @@ -0,0 +1,34 @@ +From bb3fc86f87a9acc64628e1cb32f5c8a1cfbeb880 Mon Sep 17 00:00:00 2001 +From: Pascal Bach <pascal.bach@nextrem.ch> +Date: Mon, 12 Oct 2020 21:22:46 +0200 +Subject: [PATCH] cmake: Use exported target for bz2 + +Without this change, CMake puts the entire path into the generated file. +This is not portable and makes it fail in environment like Yocto. + +Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/7541] +--- + CMakeLists.txt | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0a7f820a22..be80edb955 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,12 +149,7 @@ else() + if(WITH_BZ2) + find_package(BZip2 REQUIRED) + add_definitions(-DBZIP2) +- if(BZIP2_INCLUDE_DIRS) +- include_directories(${BZIP2_INCLUDE_DIRS}) +- else() +- include_directories(${BZIP2_INCLUDE_DIR}) +- endif() +- list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES}) ++ list(APPEND THIRDPARTY_LIBS BZip2::BZip2) + endif() + + if(WITH_LZ4) +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0003-cmake-Do-not-add-msse4.2-mpclmul-on-clang.patch b/meta-oe/recipes-dbs/rocksdb/files/0003-cmake-Do-not-add-msse4.2-mpclmul-on-clang.patch new file mode 100644 index 0000000000..e2f785d7cf --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0003-cmake-Do-not-add-msse4.2-mpclmul-on-clang.patch @@ -0,0 +1,33 @@ +From bb10f55eb77be7b7eee94cb3506c9cbef8e24099 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 26 Jan 2023 13:00:43 -0800 +Subject: [PATCH] cmake: Do not add -msse4.2 -mpclmul on clang + +When testcase is compiled with clang and -msse4.2 -mpclmul is added to +cxxflags then clang -m32 still ends up compiling the test case which is +not correct for i386, therefore depend on yocto to pass the right flags +from environemnt via cflags rather than manufecture them here + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index be80edb955..a1bbade81a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -279,7 +279,7 @@ endif() + + include(CheckCXXSourceCompiles) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +-if(NOT MSVC) ++if(NOT MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_REQUIRED_FLAGS "-msse4.2 -mpclmul") + endif() + +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0004-Implement-support-for-musl-ppc64.patch b/meta-oe/recipes-dbs/rocksdb/files/0004-Implement-support-for-musl-ppc64.patch new file mode 100644 index 0000000000..5fcf1f7dae --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0004-Implement-support-for-musl-ppc64.patch @@ -0,0 +1,42 @@ +From c6accd34e8169d7a6b92fc89dce5d4309978e39e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 21 Mar 2024 14:11:09 +0800 +Subject: [PATCH] Implement support for musl/ppc64 + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../lock/range/range_tree/lib/portability/toku_time.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +index 9b83c53511..0a7488c397 100644 +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -58,7 +58,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. + #include <stdint.h> + #include <sys/time.h> + #include <time.h> +-#if defined(__powerpc__) ++#if defined(__powerpc__) && defined(__GLIBC__) + #include <sys/platform/ppc.h> + #endif + +@@ -131,8 +131,12 @@ static inline tokutime_t toku_time_now(void) { + uint64_t result; + __asm __volatile__("mrs %[rt], cntvct_el0" : [rt] "=r"(result)); + return result; +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && defined(__GLIBC__) + return __ppc_get_timebase(); ++#elif defined(__powerpc64__) || defined(__ppc64__) ++ uint64_t result; ++ asm volatile("mfspr %0, 268" : "=r"(result)); ++ return result; + #elif defined(__s390x__) + uint64_t result; + asm volatile("stckf %0" : "=Q"(result) : : "cc"); +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch b/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch new file mode 100644 index 0000000000..2979b73d2f --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch @@ -0,0 +1,32 @@ +From 2ebc0ff33e41d23e4d3aec1a86f3d8bd4be410e7 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 21 Mar 2024 14:14:58 +0800 +Subject: [PATCH] Implement timer implementation for mips platform + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../lock/range/range_tree/lib/portability/toku_time.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +index 0a7488c397..ad7d9f2124 100644 +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -162,6 +162,12 @@ static inline tokutime_t toku_time_now(void) { + unsigned long result; + asm volatile ("rdtime.d\t%0,$r0" : "=r" (result)); + return result; ++#elif defined(__mips__) ++ // mips apparently only allows rdtsc for superusers, so we fall ++ // back to gettimeofday. It's possible clock_gettime would be better. ++ struct timeval tv; ++ gettimeofday(&tv, nullptr); ++ return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; + #else + #error No timer implementation for this platform + #endif +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0006-Implement-timer-for-arm-v6.patch b/meta-oe/recipes-dbs/rocksdb/files/0006-Implement-timer-for-arm-v6.patch new file mode 100644 index 0000000000..0ae673c425 --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0006-Implement-timer-for-arm-v6.patch @@ -0,0 +1,40 @@ +From 9e274ba2762724f353227b5a3a6e4433f706468a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 21 Mar 2024 14:16:08 +0800 +Subject: [PATCH] Implement timer for arm >= v6 + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../range/range_tree/lib/portability/toku_time.h | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +index ad7d9f2124..bcb795b7e7 100644 +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -168,6 +168,20 @@ static inline tokutime_t toku_time_now(void) { + struct timeval tv; + gettimeofday(&tv, nullptr); + return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; ++#elif (__ARM_ARCH >= 6) ++ uint32_t pmccntr; ++ uint32_t pmuseren; ++ uint32_t pmcntenset; ++ // Read the user mode perf monitor counter access permissions. ++ asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren)); ++ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. ++ asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset)); ++ if (pmcntenset & 0x80000000ul) { // Is it counting? ++ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr)); ++ // The counter is set up to count every 64th cycle ++ return (uint64_t)pmccntr * 64; // Should optimize to << 6 ++ } ++ } + #else + #error No timer implementation for this platform + #endif +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/files/0007-Fix-declaration-scope-of-LE_LOAD32-in-crc32c.patch b/meta-oe/recipes-dbs/rocksdb/files/0007-Fix-declaration-scope-of-LE_LOAD32-in-crc32c.patch new file mode 100644 index 0000000000..9ba34450ba --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0007-Fix-declaration-scope-of-LE_LOAD32-in-crc32c.patch @@ -0,0 +1,39 @@ +From ed549d43c8b691cd7891c7e5c76df189feb04b4f Mon Sep 17 00:00:00 2001 +From: Yi Zhao <yi.zhao@windriver.com> +Date: Sun, 7 Apr 2024 17:16:53 +0800 +Subject: [PATCH] Fix declaration scope of LE_LOAD32 in crc32c + +Fix build error when __SSE4_2__ is defined: +util/crc32c.cc: In function 'void rocksdb::crc32c::DefaultCRC32(uint64_t*, const uint8_t**)': +util/crc32c.cc:267:53: error: 'LE_LOAD32' was not declared in this scope + 267 | *l = _mm_crc32_u32(static_cast<unsigned int>(*l), LE_LOAD32(*p)); + | ^~~~~~~~~ + +Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/12515] + +Signed-off-by: Yi Zhao <yi.zhao@windriver.com> +--- + util/crc32c.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/crc32c.cc b/util/crc32c.cc +index 38a69bb50..aa13ad882 100644 +--- a/util/crc32c.cc ++++ b/util/crc32c.cc +@@ -242,12 +242,12 @@ static const uint32_t table3_[256] = { + 0xc747336e, 0x1a0299d6, 0x782010ef, 0xa565ba57, 0xbc65029d, 0x6120a825, + 0x0302211c, 0xde478ba4, 0x31035088, 0xec46fa30, 0x8e647309, 0x5321d9b1, + 0x4a21617b, 0x9764cbc3, 0xf54642fa, 0x2803e842}; ++#endif // !__SSE4_2__ + + // Used to fetch a naturally-aligned 32-bit word in little endian byte-order + static inline uint32_t LE_LOAD32(const uint8_t* p) { + return DecodeFixed32(reinterpret_cast<const char*>(p)); + } +-#endif // !__SSE4_2__ + + static inline void DefaultCRC32(uint64_t* l, uint8_t const** p) { + #ifndef __SSE4_2__ +-- +2.25.1 + diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_9.0.0.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_9.0.0.bb new file mode 100644 index 0000000000..444351dbb4 --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_9.0.0.bb @@ -0,0 +1,57 @@ +SUMMARY = "RocksDB an embeddable, persistent key-value store" +DESCRIPTION = "RocksDB is library that provides an embeddable, persistent key-value store for fast storage." +HOMEPAGE = "http://rocksdb.org/" +LICENSE = "(Apache-2.0 | GPL-2.0-only) & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.Apache;md5=3b83ef96387f14655fc854ddc3c6bd57 \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSE.leveldb;md5=fb04ff57a14f308f2eed4a9b87d45837" + +SRCREV = "f4441966592636253fd5ab0bb9ed44fc2697fc53" +SRCBRANCH = "9.0.fb" + +SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH};protocol=https \ + file://0001-cmake-Add-check-for-atomic-support.patch \ + file://0002-cmake-Use-exported-target-for-bz2.patch \ + file://0003-cmake-Do-not-add-msse4.2-mpclmul-on-clang.patch \ + file://0004-Implement-support-for-musl-ppc64.patch \ + file://0005-Implement-timer-implementation-for-mips-platform.patch \ + file://0006-Implement-timer-for-arm-v6.patch \ + file://0007-Fix-declaration-scope-of-LE_LOAD32-in-crc32c.patch \ + " + +SRC_URI:append:riscv32 = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:append:mips = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:append:powerpc = " file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" +SRC_URI:remove:toolchain-clang:riscv32 = "file://0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch" + +S = "${WORKDIR}/git" + +inherit cmake + +PACKAGECONFIG ??= "bzip2 zlib lz4 gflags" +PACKAGECONFIG[bzip2] = "-DWITH_BZ2=ON,-DWITH_BZ2=OFF,bzip2" +PACKAGECONFIG[lz4] = "-DWITH_LZ4=ON,-DWITH_LZ4=OFF,lz4" +PACKAGECONFIG[zlib] = "-DWITH_ZLIB=ON,-DWITH_ZLIB=OFF,zlib" +PACKAGECONFIG[zstd] = "-DWITH_ZSTD=ON,-DWITH_ZSTD=OFF,zstd" +PACKAGECONFIG[lite] = "-DROCKSDB_LITE=ON,-DROCKSDB_LITE=OFF" +PACKAGECONFIG[gflags] = "-DWITH_GFLAGS=ON,-DWITH_GFLAGS=OFF,gflags" + +# Tools and tests currently don't compile on armv5 so we disable them +EXTRA_OECMAKE = "\ + -DPORTABLE=ON \ + -DWITH_TESTS=OFF \ + -DWITH_BENCHMARK_TOOLS=OFF \ + -DWITH_TOOLS=OFF \ + -DFAIL_ON_WARNINGS=OFF \ +" + +CXXFLAGS += "${@bb.utils.contains('SELECTED_OPTIMIZATION', '-Og', '-DXXH_NO_INLINE_HINTS', '', d)}" + +do_install:append() { + # Fix for qa check buildpaths + sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/rocksdb/RocksDBTargets.cmake +} + +# Need toku_time_now() implemented for ppc/musl +# see utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +COMPATIBLE_HOST:libc-musl:powerpc = "null" diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb deleted file mode 100644 index 9fd5ee15be..0000000000 --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb +++ /dev/null @@ -1,42 +0,0 @@ -SUMMARY = "RocksDB an embeddable, persistent key-value store" -DESCRIPTION = "RocksDB is library that provides an embeddable, persistent key-value store for fast storage." -HOMEPAGE = "http://rocksdb.org/" -LICENSE = "(Apache-2.0 | GPL-2.0) & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE.Apache;md5=3b83ef96387f14655fc854ddc3c6bd57 \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LICENSE.leveldb;md5=fb04ff57a14f308f2eed4a9b87d45837" - -SRCREV = "628a7fd74b5611657106c57f724f1682b114684c" -SRCBRANCH = "6.0.fb" -PV = "6.0.2" - -SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \ - file://0001-CMake-has-stock-FindZLIB-in-upper-case.patch \ - file://0001-Disable-Wshadow-and-do-not-mark-default-copy-constru.patch \ - file://0001-utilities-Fix-build-failure-with-Werror-maybe-uninit.patch \ - file://0001-fix-Issue-5303.patch \ - " - -S = "${WORKDIR}/git" - -inherit cmake - -PACKAGECONFIG ??= "bzip2 zlib lz4 gflags" -PACKAGECONFIG[bzip2] = "-DWITH_BZ2=ON -DBZIP2_LIBRARIES:STRING=bz2,-DWITH_BZ2=OFF,bzip2" -PACKAGECONFIG[lz4] = "-DWITH_LZ4=ON -DLZ4_LIBRARIES:STRING=lz4,-DWITH_LZ4=OFF,lz4" -PACKAGECONFIG[zlib] = "-DWITH_ZLIB=ON -DZLIB_LIBRARY:STRING=z,-DWITH_ZLIB=OFF,zlib" -PACKAGECONFIG[zstd] = "-DWITH_ZSTD=ON,-DWITH_ZSTD=OFF,zstd" -PACKAGECONFIG[lite] = "-DROCKSDB_LITE=ON,-DROCKSDB_LITE=OFF" -PACKAGECONFIG[gflags] = "-DWITH_GFLAGS=ON,-DWITH_GFLAGS=OFF,gflags" - -# Tools and tests currently don't compile on armv5 so we disable them -EXTRA_OECMAKE = "\ - -DPORTABLE=ON \ - -DWITH_TESTS=OFF \ - -DWITH_TOOLS=OFF \ -" - -do_install_append() { - # fix for qa check buildpaths - sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/rocksdb/RocksDBTargets.cmake -} |