bytedance / terarkdb

A RocksDB compatible KV storage engine with better performance
Apache License 2.0
2.04k stars 203 forks source link

python rocksdb编译terarkdb #214

Closed shnuhw closed 2 years ago

shnuhw commented 2 years ago

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-3.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing -fno-rtti In file included from /terarkdb/include/rocksdb/comparator.h:13, from rocksdb/_rocksdb.cpp:713: /terarkdb/include/rocksdb/comparator_lambda.h:5:10: fatal error: utilities/util/function.hpp: No such file or directory

include "utilities/util/function.hpp"

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

看了下编译后的include,确实没有这个文件,甚至没有util目录
shnuhw commented 2 years ago

/terarkdb/build/build/include/rocksdb/comparator_lambda.h确实引用了这个文件: // Copyright (c) 2020-present, Bytedance Inc. All rights reserved. // This source code is licensed under Apache 2.0 License.

pragma once

include "rocksdb/terark_namespace.h"

include "utilities/util/function.hpp"

namespace TERARKDB_NAMESPACE {

template struct StdComparareLessType { const Comp* cmp; template bool operator()(const T& x, const T& y) const { return cmp->Compare(x, y) < 0; } }; 麻烦能看下不,谢谢!

yapple commented 2 years ago

can your share your project in github? i would try to fix it It would be better if it could be packaged into a docker environment

shnuhw commented 2 years ago

can your share your project in github? i would try to fix it

I use this proj,https://github.com/twmht/python-rocksdb and yes, I packaged and compile it in docker and above question occured!

yapple commented 2 years ago

This issue may be helpful to you, focus on the processing related to Include header files https://github.com/bytedance/terarkdb/issues/98

shnuhw commented 2 years ago

This issue may be helpful to you, focus on the processing related to Include header files #98

I think the two questions are not the same condition. I do not use TerarkZipTable. Just want to use standard rocksdb api for terarkdb. File comparator_lambda.h include "utilities/util/function.hpp", wherre to find this cpp file is not sure!

yapple commented 2 years ago
cd terarkdb
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/include/
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}`pwd`/build/
$ export LIBRARY_PATH=${LIBRARY_PATH}${LIBRARY_PATH:+:}`pwd`/build/
yapple commented 2 years ago

This issue may be helpful to you, focus on the processing related to Include header files #98

I think the two questions are not the same condition. I do not use TerarkZipTable. Just want to use standard rocksdb api for terarkdb. File comparator_lambda.h include "utilities/util/function.hpp", wherre to find this cpp file is not sure!

you can find it in "terarkdb/utilities/util/" instead of "terarkdb/include/" maybe our public header should't include the private header

yapple commented 2 years ago
cd terarkdb
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/include/
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}`pwd`/build/
$ export LIBRARY_PATH=${LIBRARY_PATH}${LIBRARY_PATH:+:}`pwd`/build/

You can try to include the header files of the entire project first

shnuhw commented 2 years ago
cd terarkdb
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/include/
$ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}`pwd`/build/
$ export LIBRARY_PATH=${LIBRARY_PATH}${LIBRARY_PATH:+:}`pwd`/build/

You can try to include the header files of the entire project first

It works. Some other probloms occured, but I fixed it and compiled it for python correctly. Now I can use python-rocksdb for terarkdb. Thank you very much!!!