CentOS 编译安装 Nebula Graph 3.10
Posted 文大侠
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 编译安装 Nebula Graph 3.10相关的知识,希望对你有一定的参考价值。
步骤
下载源码
git下载
git clone --branch release-3.1 https://github.com/vesoft-inc/nebula.git
releases下载
wget https://github.com/vesoft-inc/nebula/archive/refs/tags/v3.1.0.tar.gz
环境准备
- 安装编译器gcc和cmake
CentOS 7 安装devtoolset-9
CentOS 8 默认8.5 gcc即可
- 安装依赖库
$ yum update
$ yum install -y make \\
m4 \\
git \\
wget \\
unzip \\
xz \\
readline-devel \\
ncurses-devel \\
zlib-devel \\
gcc \\
gcc-c++ \\
cmake \\
curl \\
redhat-lsb-core \\
bzip2
// 仅 CentOS 8+、RedHat 8+、Fedora 需要安装 libstdc++-static 和 libasan。
$ yum install -y libstdc++-static libasan
参考 准备资源 - Nebula Graph Database 手册
cmake预构建
进入源码目录
普通构建
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF --DCMAKE_BUILD_TYPE=Release ..
存算合并版本构建
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DENABLE_STANDALONE_VERSION=on -DCMAKE_BUILD_TYPE=Release ..
参考 使用源码安装 - Nebula Graph Database 手册
构建
make -jN
指定并行度编译 比如make -j10
安装
默认安装在-DCMAKE_INSTALL_PREFIX=/usr/local/nebula指定的目录
如果是其它的机器上安装,拷贝目录过去,需要glibc版本一致
sudo make install
运行
普通版本
/usr/local/nebula/scripts/nebula.service start all
/usr/local/nebula/scripts/nebula.service status all
存算合并版本
/usr/local/nebula/scripts/nebula-standalone.service start
/usr/local/nebula/scripts/nebula-standalone.service status
问题
1.找不到包
将cmake/nebula/ThirdPartyConfig.cmake中的 find_package(Bzip2 REQUIRED) 和find_package(Fatal REQUIRED)删除。工程的依赖有问题。
参考 Nebula-V3.01源码编译找不到包 - 使用问题 - NebulaGraph
2.链接缺少libc
CentOS Stream release 8 链接时libstdc++库缺少
参考 nebula3.1.0 Linking CXX executable ../../bin/nebula-metad过程中产生的问题
3.cmake 第三方库查找失败
centos 7.9上 source /opt/rh/devtoolset-8/enable
如下find_package找不到第三方包
核心原因是当前第三方包位官方预编译好放在云端供下载的, 编译脚本会默认按照当前编译环境查找对应的第三方包下载供使用,这里核心是不存在对应的云端版本的第三方预编译库。
nebula 3.0有9.3.0 gcc的third party,更换gcc版本即可(安装切换devtoolset-9),如下
4.链接rocksdb失败
centos 7.9上 source /opt/rh/devtoolset-9/enable
cmake成功,问题是链接是大量报rocksdb链接错误,如下
RocksEngine.cpp:(.text+0x4db3): undefined reference to `rocksdb::SstFileWriter::Open(std::string const&)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngine.cpp:(.text+0x51e3): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngine.cpp:(.text+0x52d4): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngine.cpp:(.text+0x5382): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngine.cpp.o: in function `nebula::kvstore::RocksEngine::multiRemove(std::vector<std::string, std::allocator<std::string> >)':
RocksEngine.cpp:(.text+0x63e5): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngine.cpp.o: in function `nebula::kvstore::RocksEngine::multiPut(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > >)':
RocksEngine.cpp:(.text+0x667d): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::initRocksdbOptions(rocksdb::Options&, int, int)':
RocksEngineConfig.cpp:(.text+0xe62): undefined reference to `rocksdb::GetDBOptionsFromMap(rocksdb::DBOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, rocksdb::DBOptions*, bool, bool)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngineConfig.cpp:(.text+0x1222): undefined reference to `rocksdb::GetColumnFamilyOptionsFromMap(rocksdb::ColumnFamilyOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, rocksdb::ColumnFamilyOptions*, bool, bool)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngineConfig.cpp:(.text+0x2dde): undefined reference to `rocksdb::GetBlockBasedTableOptionsFromMap(rocksdb::BlockBasedTableOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, rocksdb::BlockBasedTableOptions*, bool, bool)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: RocksEngineConfig.cpp:(.text+0x33ce): undefined reference to `rocksdb::NewConcurrentTaskLimiter(std::string const&, int)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnBackgroundError(rocksdb::BackgroundErrorReason, rocksdb::Status*)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener17OnBackgroundErrorEN7rocksdb21BackgroundErrorReasonEPNS2_6StatusE[_ZN6nebula7kvstore13EventListener17OnBackgroundErrorEN7rocksdb21BackgroundErrorReasonEPNS2_6StatusE]+0xad): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnErrorRecoveryBegin(rocksdb::BackgroundErrorReason, rocksdb::Status, bool*)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener20OnErrorRecoveryBeginEN7rocksdb21BackgroundErrorReasonENS2_6StatusEPb[_ZN6nebula7kvstore13EventListener20OnErrorRecoveryBeginEN7rocksdb21BackgroundErrorReasonENS2_6StatusEPb]+0xad): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnErrorRecoveryCompleted(rocksdb::Status)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener24OnErrorRecoveryCompletedEN7rocksdb6StatusE[_ZN6nebula7kvstore13EventListener24OnErrorRecoveryCompletedEN7rocksdb6StatusE]+0x56): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnCompactionCompleted(rocksdb::DB*, rocksdb::CompactionJobInfo const&)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener21OnCompactionCompletedEPN7rocksdb2DBERKNS2_17CompactionJobInfoE[_ZN6nebula7kvstore13EventListener21OnCompactionCompletedEPN7rocksdb2DBERKNS2_17CompactionJobInfoE]+0xde): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnCompactionBegin(rocksdb::DB*, rocksdb::CompactionJobInfo const&)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener17OnCompactionBeginEPN7rocksdb2DBERKNS2_17CompactionJobInfoE[_ZN6nebula7kvstore13EventListener17OnCompactionBeginEPN7rocksdb2DBERKNS2_17CompactionJobInfoE]+0xde): undefined reference to `rocksdb::Status::ToString() const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnExternalFileIngested(rocksdb::DB*, rocksdb::ExternalFileIngestionInfo const&)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener22OnExternalFileIngestedEPN7rocksdb2DBERKNS2_25ExternalFileIngestionInfoE[_ZN6nebula7kvstore13EventListener22OnExternalFileIngestedEPN7rocksdb2DBERKNS2_25ExternalFileIngestionInfoE]+0x121): undefined reference to `rocksdb::TableProperties::ToString(std::string const&, std::string const&) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnFlushCompleted(rocksdb::DB*, rocksdb::FlushJobInfo const&)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener16OnFlushCompletedEPN7rocksdb2DBERKNS2_12FlushJobInfoE[_ZN6nebula7kvstore13EventListener16OnFlushCompletedEPN7rocksdb2DBERKNS2_12FlushJobInfoE]+0x1ba): undefined reference to `rocksdb::TableProperties::ToString(std::string const&, std::string const&) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o: in function `nebula::kvstore::EventListener::OnFlushBegin(rocksdb::DB*, rocksdb::FlushJobInfo const&)':
RocksEngineConfig.cpp:(.text._ZN6nebula7kvstore13EventListener12OnFlushBeginEPN7rocksdb2DBERKNS2_12FlushJobInfoE[_ZN6nebula7kvstore13EventListener12OnFlushBeginEPN7rocksdb2DBERKNS2_12FlushJobInfoE]+0x1ba): undefined reference to `rocksdb::TableProperties::ToString(std::string const&, std::string const&) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x20): undefined reference to `rocksdb::Customizable::GetOption(rocksdb::ConfigOptions const&, std::string const&, std::string*) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x28): undefined reference to `rocksdb::Customizable::AreEquivalent(rocksdb::ConfigOptions const&, rocksdb::Configurable const*, std::string*) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x48): undefined reference to `rocksdb::Configurable::GetOptionsPtr(std::string const&) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x50): undefined reference to `rocksdb::Configurable::ParseStringOptions(rocksdb::ConfigOptions const&, std::string const&)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x58): undefined reference to `rocksdb::Configurable::ConfigureOptions(rocksdb::ConfigOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > >*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x60): undefined reference to `rocksdb::Configurable::ParseOption(rocksdb::ConfigOptions const&, rocksdb::OptionTypeInfo const&, std::string const&, std::string const&, void*)'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x68): undefined reference to `rocksdb::Configurable::OptionsAreEqual(rocksdb::ConfigOptions const&, rocksdb::OptionTypeInfo const&, std::string const&, void const*, void const*, std::string*) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x70): undefined reference to `rocksdb::Customizable::SerializeOptions(rocksdb::ConfigOptions const&, std::string const&) const'
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld.bfd: ../kvstore/CMakeFiles/kvstore_obj.dir/RocksEngineConfig.cpp.o:(.rodata._ZTVN6nebula7kvstore13EventListenerE[_ZTVN6nebula7kvstore13EventListenerE]+0x78): undefined reference to `rocksdb::Customizable::GetOptionName(std::string const&) const'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/nebula-standalone] 错误 1
make[1]: *** [src/daemons/CMakeFiles/nebula-standalone.dir/all] 错误 2
make: *** [all] 错误 2
待解决
以上是关于CentOS 编译安装 Nebula Graph 3.10的主要内容,如果未能解决你的问题,请参考以下文章