Skip to content

Commit

Permalink
[cachelib] add new facebook cachelib port (#29973)
Browse files Browse the repository at this point in the history
* Add new unofficial facebook cachelib port

* fix comments

* versions

* update version database

* update deps & version database

* update deps & version databases

* fix comments

* update version database

* find numa.h and warn when not found
  • Loading branch information
gavxin authored Mar 20, 2023
1 parent 7502c79 commit 7d5f1f3
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
53 changes: 53 additions & 0 deletions ports/cachelib/fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/cachelib/cachebench/util/JSONConfig.h b/cachelib/cachebench/util/JSONConfig.h
index 7da93fc4..cb46b33b 100644
--- a/cachelib/cachebench/util/JSONConfig.h
+++ b/cachelib/cachebench/util/JSONConfig.h
@@ -146,10 +146,6 @@ struct Options {};

template <typename Type, size_t size>
constexpr void checkCorrectSize() {
-#ifndef SKIP_OPTION_SIZE_VERIFY
- Options<sizeof(Type)> var = Options<size>{};
- (void)var;
-#endif
}
} // namespace cachebench
} // namespace cachelib
diff --git a/cachelib/common/CMakeLists.txt b/cachelib/common/CMakeLists.txt
index 1e6d1a88..fad14a18 100644
--- a/cachelib/common/CMakeLists.txt
+++ b/cachelib/common/CMakeLists.txt
@@ -36,9 +36,6 @@ target_link_libraries(cachelib_common PUBLIC
FBThrift::thriftprotocol
Folly::folly
Folly::follybenchmark
- Folly::folly_exception_tracer
- Folly::folly_exception_tracer_base
- Folly::folly_exception_counter
)

install(TARGETS cachelib_common
diff --git a/cachelib/common/Utils.cpp b/cachelib/common/Utils.cpp
index 3e149469..0e6b6d9c 100644
--- a/cachelib/common/Utils.cpp
+++ b/cachelib/common/Utils.cpp
@@ -15,7 +15,6 @@
*/

#include <dirent.h>
-#include <folly/experimental/exception_tracer/ExceptionTracer.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/shm.h>
@@ -420,10 +419,6 @@ size_t getMemAvailable() {
}

void printExceptionStackTraces() {
- auto exceptions = folly::exception_tracer::getCurrentExceptions();
- for (auto& exc : exceptions) {
- std::cerr << exc << std::endl;
- }
}

} // namespace util

37 changes: 37 additions & 0 deletions ports/cachelib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/CacheLib
REF "v${VERSION}"
SHA512 53f2eb4de0d1c5d4184d7e1d8ceb958625d9426eebaf434227179c9b2a6ed3a3bf063758f86c2e517ca910556230a764bfd54890dc718c2f45aec1d5a806788c
HEAD_REF master
PATCHES
fix-build.patch
)

FIND_PATH(NUMA_INCLUDE_DIR NAME numa.h
PATHS ENV NUMA_ROOT
HINTS "$ENV{HOME}/local/include" /opt/local/include /usr/local/include /usr/include
)

IF (NOT NUMA_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
ENDIF ()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/cachelib"
OPTIONS
-DBUILD_TESTS=OFF
-DCMAKE_INSTALL_DIR=share/cachelib
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/cachelib PACKAGE_NAME cachelib)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

vcpkg_fixup_pkgconfig()
27 changes: 27 additions & 0 deletions ports/cachelib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "cachelib",
"version-string": "2023.02.27.00",
"description": "facebook cachelib",
"homepage": "https://github.com/facebook/CacheLib",
"license": "Apache-2.0",
"supports": "linux & x64 & static",
"dependencies": [
"fbthrift",
"fizz",
"fmt",
"folly",
"gflags",
"glog",
"gtest",
"tsl-sparse-map",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"wangle"
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@
"baseline": "0.7.0",
"port-version": 0
},
"cachelib": {
"baseline": "2023.02.27.00",
"port-version": 0
},
"caf": {
"baseline": "0.18.6",
"port-version": 1
Expand Down
9 changes: 9 additions & 0 deletions versions/c-/cachelib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "0311771f0b688e0ff8ffd3c6d297dfbbf43dfd33",
"version-string": "2023.02.27.00",
"port-version": 0
}
]
}

0 comments on commit 7d5f1f3

Please sign in to comment.