我已经尝试为iOS编译rocksdb平台一段时间了。简单的git克隆回购并运行。
TARGET_OS="IOS" make static_lib -j8如果出现大量错误,就会失败,而且我也不确定在哪里可以添加预处理器指令。
然后,我一直在查看包装器,并试图将它们编译成更晚的版本:
(librocksdb.podspec)
s.name = 'librocksdb'
s.version = '***6.22.1***'
s.summary = 'rocksdb bindings for Swift. Cocoapods and SPM support. Linux support.'(rocksdb.swift.podspec)
s.name = 'rocksdb.swift'
s.version = '***6.22.1***'
s.summary = 'rocksdb Wrapper for Swift. Cocoapods and SPM support. Linux support.'
...
s.dependency 'librocksdb', '~> ***6.22.1***'
...pod安装现在失败了,因为它找不到librocksdb的“新”版本,所以我用:path =>格式将librocksdb和rocksdb.swift添加到Podfile中。然后,吊舱安装,Xcode项目出现此错误。
/.../librdb/librocksdb/rocksdb/memtable/write_buffer_manager.cc:10:10: 'rocksdb/write_buffer_manager.h' file not foundmonitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
1 error generated.
$DEBUG_LEVEL is 0
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
monitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
1 error generated.
In file included from cache/sharded_cache.cc:16:
In file included from ./util/hash.h:26:
./util/fastrange.h:60:5: error: unknown type name '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:24: error: use of undeclared identifier '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:35: error: expected ';' at end of declaration
__uint128_t wide = __uint128_t{range} * hash;
^
;
./util/fastrange.h:53:35: error: unused parameter 'hash' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
./util/fastrange.h:53:47: error: unused parameter 'range' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
5 errors generated.我尝试将相关标志添加到CFLAGS变量中,并添加-std=c++17标志以尝试解决uint__128问题。然后这就失败了
./cache/lru_cache.h:269:11: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on iOS 11 or newer
virtual ~LRUCacheShard() override = default;
^
cache/lru_cache.cc:656:18: note: in defaulted destructor for 'rocksdb::LRUCacheShard' first required here
shards_[i].~LRUCacheShard();
^
./cache/lru_cache.h:269:11: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
virtual ~LRUCacheShard() override = default;
^
1 error generated.使用将IOS_SDK_VERSION更改为Build-Rocb-ios.sh脚本中的较新版本无法解决这一问题。
因此,我正在寻找一个已经为iOS编译了rocksdb /rocksdb包装器的最近版本的人,并且正在寻找指导。
提亚
发布于 2022-06-29 03:38:14
尝试RocksDB 6.x版本,从7.0 RocksDB需要C++17。
发布于 2022-06-29 03:41:55
#Xcode Version 13.2.1 (13C100)
$ brew install git
$ brew install cmake
$ git clone https://github.com/facebook/rocksdb.git
$ git checkout v6.29.5
$ export PORTABLE=1
$ export TARGET_OS=IOS
$ export ROCKSDB_LITE=1
$ export IOS_CROSS_COMPILE=1
#disable int128
$ export TEST_UINT128_COMPAT=1
$ export DISABLE_WARNING_AS_ERROR=1
$ export DEBUG_LEVEL=0
$ export EXTRA_CXXFLAGS="-DNPERF_CONTEXT -DNIOSTATS_CONTEXT"
$ make V=1 VERBOSE=1 -j16 static_libhttps://stackoverflow.com/questions/71205324
复制相似问题