added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,70 @@
From 6e376601c990abaa5e261d1311f92acb3b370b8f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 24 Jan 2023 21:40:43 -0800
Subject: [PATCH] Add missing includes <cstdint> and <cstdio>
This is needed with GCC 13 and newer [1]
[1] https://www.gnu.org/software/gcc/gcc-13/porting_to.html
Upstream-Status: Backport [https://github.com/facebook/rocksdb/commit/88edfbfb5e1cac228f7cc31fbec24bb637fe54b1]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../rocksdb/rocksdb/db/compaction/compaction_iteration_stats.h | 1 +
storage/rocksdb/rocksdb/include/rocksdb/utilities/checkpoint.h | 1 +
.../rocksdb/rocksdb/table/block_based/data_block_hash_index.h | 1 +
storage/rocksdb/rocksdb/util/slice.cc | 1 +
storage/rocksdb/rocksdb/util/string_util.h | 1 +
tpool/aio_linux.cc | 1 +
6 files changed, 6 insertions(+)
--- a/db/compaction/compaction_iteration_stats.h
+++ b/db/compaction/compaction_iteration_stats.h
@@ -7,6 +7,7 @@
#include <cstdint>
+#include <cstdint>
#include "rocksdb/rocksdb_namespace.h"
namespace ROCKSDB_NAMESPACE {
--- a/include/rocksdb/utilities/checkpoint.h
+++ b/include/rocksdb/utilities/checkpoint.h
@@ -8,6 +8,7 @@
#pragma once
#ifndef ROCKSDB_LITE
+#include <cstdint>
#include <string>
#include <vector>
--- a/table/block_based/data_block_hash_index.h
+++ b/table/block_based/data_block_hash_index.h
@@ -5,6 +5,7 @@
#pragma once
+#include <cstdint>
#include <string>
#include <vector>
--- a/util/slice.cc
+++ b/util/slice.cc
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <algorithm>
+#include <cstdint>
#include "rocksdb/convenience.h"
#include "rocksdb/slice_transform.h"
--- a/util/string_util.h
+++ b/util/string_util.h
@@ -6,6 +6,7 @@
#pragma once
+#include <cstdint>
#include <sstream>
#include <string>
#include <unordered_map>

View File

@@ -0,0 +1,114 @@
From cf168ae0b7bceab8432d096719b331f18428fe39 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
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1057,7 +1057,12 @@ set(ROCKSDB_SHARED_LIB rocksdb-shared${A
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 "")
--- /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()
+

View File

@@ -0,0 +1,33 @@
From cedc84a8db468d0b6652e78a8a6667e655586b53 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 dbef059028..981545a4e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -290,7 +290,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.39.1

View File

@@ -0,0 +1,29 @@
From 46a4e585175cac8d76bd0b64f0fc27c9e22f04a1 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 | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,12 +154,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)

View File

@@ -0,0 +1,59 @@
From 114c42fba3fc86119710e8dd1bb2b7a9e39e3064 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
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(-)
--- 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

View File

@@ -0,0 +1,26 @@
implement timer for arm >= v6
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -164,6 +164,20 @@ static inline tokutime_t toku_time_now(v
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

View File

@@ -0,0 +1,18 @@
implement timer implementation for mips platform
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -158,6 +158,12 @@ static inline tokutime_t toku_time_now(v
uint64_t cycles;
asm volatile("rdcycle %0" : "=r"(cycles));
return cycles;
+#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

View File

@@ -0,0 +1,28 @@
implement support for musl/ppc64
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- 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
#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(v
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");

View File

@@ -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 = "444b3f4845dd01b0d127c4b420fdd3b50ad56682"
SRCBRANCH = "7.9.fb"
SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH};protocol=https \
file://0001-cmake-Add-check-for-atomic-support.patch \
file://0001-cmake-Use-exported-target-for-bz2.patch \
file://0001-Add-missing-includes-cstdint-and-cstdio.patch \
file://0001-cmake-Do-not-add-msse4.2-mpclmul-on-clang.patch \
file://ppc64.patch \
file://mips.patch \
file://arm.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 \
"
do_install:append() {
# fix for qa check buildpaths
sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/rocksdb/RocksDBTargets.cmake
}
LDFLAGS:append:riscv64 = " -pthread"
# 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"