diff --git a/CMakeLists.txt b/CMakeLists.txt index 8542e1343..510ee2979 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,19 +8,10 @@ # # CMAKE_C_COMPILER -- Specify the compiler for C language # CMAKE_CXX_COMPILER -- Specify the compiler for C++ language - -# NEBULA_GPERF_BIN_DIR -- Specify the full path to the directory -# containing gperf binary -# NEBULA_FLEX_ROOT -- Specify the root directory for flex -# NEBULA_BISON_ROOT -- Specify the root directory for bison -# NEBULA_READLINE_ROOT -- Specify the root directory for readline -# NEBULA_NCURSES_ROOT -- Specify the root directory for ncurses -# NEBULA_KRB5_ROOT -- Specify the root directory for KRB5 -# NEBULA_LIBUNWIND_ROOT -- Specify the root directory for libunwind -# NEBULA_OPENSSL_ROOT -- Specify the root directory for openssl -# NEBULA_BOOST_ROOT -- Specify the root directory for boost - -# NEBULA_THIRDPARTY_ROOT -- Specify the root directory for third-party +# +# NEBULA_THIRDPARTY_ROOT -- Specify the root directory for third-party +# NEBULA_OTHER_ROOT -- Specify the root directory for user build +# -- Split with ":", exp: DIR:DIR # # SKIP_JAVA_CLIENT -- Skip building the java client # ENABLE_JEMALLOC -- Link jemalloc into all executables @@ -129,61 +120,6 @@ endif() # To include customized FindXXX.cmake modules set(CMAKE_MODULE_PATH "${NEBULA_HOME}/cmake" ${CMAKE_MODULE_PATH}) -if(NOT ${NEBULA_KRB5_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_KRB5_ROOT: " ${NEBULA_KRB5_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_KRB5_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_KRB5_ROOT}/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_KRB5_ROOT}/bin) -endif() - -if(NOT ${NEBULA_LIBUNWIND_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_LIBUNWIND_ROOT: " ${NEBULA_LIBUNWIND_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_LIBUNWIND_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_LIBUNWIND_ROOT}/lib) -endif() - -if(NOT ${NEBULA_OPENSSL_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_OPENSSL_ROOT: " ${NEBULA_OPENSSL_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_OPENSSL_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_OPENSSL_ROOT}/lib) -endif() - -if(NOT ${NEBULA_BOOST_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_BOOST_ROOT: " ${NEBULA_BOOST_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_BOOST_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_BOOST_ROOT}/lib) -endif() - -if(NOT ${NEBULA_READLINE_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_READLINE_ROOT: " ${NEBULA_READLINE_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_READLINE_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_READLINE_ROOT}/lib) -endif() - -if(NOT ${NEBULA_NCURSES_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_NCURSES_ROOT: " ${NEBULA_NCURSES_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_NCURSES_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_NCURSES_ROOT}/lib) -endif() - -if(NOT ${NEBULA_FLEX_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_FLEX_ROOT: " ${NEBULA_FLEX_ROOT}) - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_FLEX_ROOT}/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_FLEX_ROOT}/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_FLEX_ROOT}/bin) -endif() - -if(NOT ${NEBULA_BISON_ROOT} STREQUAL "") - message(STATUS "Specified NEBULA_BISON_ROOT: " ${NEBULA_BISON_ROOT}) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_BISON_ROOT}/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_BISON_ROOT}/bin) -endif() - -if(NOT ${NEBULA_GPERF_BIN_DIR} STREQUAL "") - message(STATUS "Specified NEBULA_GPERF_BIN_DIR: " ${NEBULA_GPERF_BIN_DIR}) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_GPERF_BIN_DIR}) -endif() - # When NEBULA_THIRDPARTY_ROOT is null, set default value as /opt/nebula/third-party if("${NEBULA_THIRDPARTY_ROOT}" STREQUAL "") SET(NEBULA_THIRDPARTY_ROOT "/opt/nebula/third-party") @@ -192,80 +128,27 @@ endif() # third-party if(NOT ${NEBULA_THIRDPARTY_ROOT} STREQUAL "") message(STATUS "Specified NEBULA_THIRDPARTY_ROOT: " ${NEBULA_THIRDPARTY_ROOT}) - # bzip2 - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/bzip2/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/bzip2/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/bzip2/bin) - - # double-conversion - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/double-conversion/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/double-conversion/lib) - - # fatal - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/fatal/include) - - # fbthrift - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/fbthrift/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/fbthrift/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/fbthrift/bin) - - # folly - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/folly/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/folly/lib) - - # gflags - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/gflags/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/gflags/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/gflags/bin) - - # glog - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/glog/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/glog/lib) - - # googletest - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/googletest/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/googletest/lib) - - # jemalloc - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/jemalloc/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/jemalloc/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/jemalloc/bin) - - # libevent - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/libevent/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/libevent/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/libevent/bin) - - # mstch - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/mstch/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/mstch/lib) - - # proxygen - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/proxygen/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/proxygen/lib) - - # rocksdb - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/rocksdb/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/rocksdb/lib) - set(ROCKSDB_LIBRARIES ${NEBULA_ROCKSDB_ROOT}/lib/librocksdb.a) - - # snappy - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/snappy/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/snappy/lib) - - # wangle - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/wangle/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/wangle/lib) - - # zlib - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/zlib/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/zlib/lib) - - # zstd - list(INSERT CMAKE_INCLUDE_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/zstd/include) - list(INSERT CMAKE_LIBRARY_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/zstd/lib) - list(INSERT CMAKE_PROGRAM_PATH 0 ${NEBULA_THIRDPARTY_ROOT}/zstd/bin) + list(APPEND CMAKE_INCLUDE_PATH ${NEBULA_THIRDPARTY_ROOT}/include) + list(APPEND CMAKE_LIBRARY_PATH ${NEBULA_THIRDPARTY_ROOT}/lib) + list(APPEND CMAKE_LIBRARY_PATH ${NEBULA_THIRDPARTY_ROOT}/lib64) + list(APPEND CMAKE_PROGRAM_PATH ${NEBULA_THIRDPARTY_ROOT}/bin) + include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/include) + link_directories( + ${NEBULA_THIRDPARTY_ROOT}/lib + ${NEBULA_THIRDPARTY_ROOT}/lib64 + ) +endif() +if(NOT ${NEBULA_OTHER_ROOT} STREQUAL "") + string(REPLACE ":" ";" DIR_LIST ${NEBULA_OTHER_ROOT}) + list(LENGTH DIR_LIST len) + foreach(DIR IN LISTS DIR_LIST ) + list(INSERT CMAKE_INCLUDE_PATH 0 ${DIR}/include) + list(INSERT CMAKE_LIBRARY_PATH 0 ${DIR}/lib) + list(INSERT CMAKE_PROGRAM_PATH 0 ${DIR}/bin) + include_directories(SYSTEM ${DIR}/include) + link_directories(${DIR}/lib) + endforeach() endif() string(REPLACE ";" ":" INCLUDE_PATH_STR "${CMAKE_INCLUDE_PATH}") @@ -424,29 +307,6 @@ macro(nebula_add_library name type) ) endmacro() -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/bzip2/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/double-conversion/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/fatal/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/fbthrift/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/folly/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/gflags/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/glog/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/googletest/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/jemalloc/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/libevent/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/mstch/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/proxygen/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/rocksdb/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/snappy/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/wangle/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/zlib/include) -include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/zstd/include) -include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) -include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) -include_directories(SYSTEM ${KRB5_INCLUDE_DIRS}) -include_directories(SYSTEM ${FLEX_INCLUDE_DIRS}) -include_directories(SYSTEM ${NCURSES_INCLUDE_DIR}) -include_directories(SYSTEM ${Readline_INCLUDE_DIR}) include_directories(AFTER ${NEBULA_HOME}/src) include_directories(AFTER src/common) include_directories(AFTER src/interface) @@ -456,28 +316,6 @@ include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/kvstore/plugins) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/kvstore/plugins/hbase) include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/src/parser) -link_directories( - ${NEBULA_THIRDPARTY_ROOT}/bzip2/lib - ${NEBULA_THIRDPARTY_ROOT}/double-conversion/lib - ${NEBULA_THIRDPARTY_ROOT}/fatal/lib - ${NEBULA_THIRDPARTY_ROOT}/fbthrift/lib - ${NEBULA_THIRDPARTY_ROOT}/folly/lib - ${NEBULA_THIRDPARTY_ROOT}/gflags/lib - ${NEBULA_THIRDPARTY_ROOT}/glog/lib - ${NEBULA_THIRDPARTY_ROOT}/googletest/lib - ${NEBULA_THIRDPARTY_ROOT}/jemalloc/lib - ${NEBULA_THIRDPARTY_ROOT}/libevent/lib - ${NEBULA_THIRDPARTY_ROOT}/mstch/lib - ${NEBULA_THIRDPARTY_ROOT}/proxygen/lib - ${NEBULA_THIRDPARTY_ROOT}/rocksdb/lib - ${NEBULA_THIRDPARTY_ROOT}/snappy/lib - ${NEBULA_THIRDPARTY_ROOT}/wangle/lib - ${NEBULA_THIRDPARTY_ROOT}/zlib/lib - ${NEBULA_THIRDPARTY_ROOT}/zstd/lib - ${Boost_LIBRARY_DIRS} - ${KRB5_LIBRARY_DIRS} -) - # All thrift libraries set(THRIFT_LIBRARIES thriftcpp2 diff --git a/docs/how-to-build.md b/docs/how-to-build.md index f0243b2fa..a54a82e49 100644 --- a/docs/how-to-build.md +++ b/docs/how-to-build.md @@ -8,7 +8,7 @@ Nebula is developed based C++14, so it requires a compiler supporting C++14 feat ### Supported system version - Fedora29, 30 -- Centos6.5, 7.5 +- Centos6.5, Centos7.0~7.6 - Ubuntu16.04, 18.04 ### Required storage @@ -38,6 +38,13 @@ bash> git clone https://github.com/vesoft-inc/nebula.git - user's environment cannot download oss packages directly Step 1: + Install others through local sources + + ``` + bash> cd nebula && ./build_dep.sh N + ``` + + Step 2: Download the corresponding version of the dependency package **user in China** @@ -55,7 +62,7 @@ bash> git clone https://github.com/vesoft-inc/nebula.git - [Ubuntu1604](https://nebula-graph-us.oss-us-west-1.aliyuncs.com/build-deb/ubuntu16.tar.gz) - [Ubuntu1804](https://nebula-graph-us.oss-us-west-1.aliyuncs.com/build-deb/ubuntu18.tar.gz) - Step 2: + Step 3: Install the package ``` @@ -63,37 +70,19 @@ bash> git clone https://github.com/vesoft-inc/nebula.git cd ${package_name} && ./install.sh ``` - Step 3: - Install others through local sources - - ``` - bash> cd nebula && ./build_dep.sh N - ``` - #### Step 3: update **~/.bashrc** ``` bash> source ~/.bashrc ``` #### Step 4: build -- without java client - - ``` - bash> mkdir build && cd build - bash> cmake .. - bash> make - bash> sudo make install - ``` -- with java client - - ``` - bash> mvn install:install-file -Dfile=/opt/nebula/third-party/fbthrift/thrift-1.0-SNAPSHOT.jar -DgroupId="com.facebook" -DartifactId="thrift" -Dversion="1.0-SNAPSHOT" -Dpackaging=jar - bash> mkdir build && cd build - bash> cmake -DSKIP_JAVA_CLIENT=OFF .. - bash> make - bash> sudo make install - ``` +``` +bash> mkdir build && cd build +bash> cmake .. +bash> make +bash> sudo make install +``` #### **Building completed** - If no errors are shown @@ -211,3 +200,22 @@ nebula> SHOW HOSTS; sudo update-alternatives --config java ``` and select the java-1.8.0-openjdk/java-8-openjdk + +- **Error info**: `internal error` + + **resolve** + + You need to compile the third-party by yourself, the installation path is **/opt/nebula/third-party** + + ``` + bash> wget https://nebula-graph-us.oss-us-west-1.aliyuncs.com/third-party/nebula-3rdparty.tar.gz + bash> tar xf nebula-3rdparty.tar.gz && cd nebula-3rdparty + bash> ./install_deps.sh + bash> sudo make + bash> cd nebula && ./build_dep.sh N + bash> source ~/.bashrc + bash> mkdir build && cd build + bash> cmake .. + bash> make + bash> sudo make install + ``` diff --git a/docs/manual-CN/how-to-build.md b/docs/manual-CN/how-to-build.md index 2c6072d2c..bef1a44de 100644 --- a/docs/manual-CN/how-to-build.md +++ b/docs/manual-CN/how-to-build.md @@ -4,7 +4,7 @@ Nebula 基于 C++14 开发,因此它需要一个支持 C++14 的编译器。 ### 支持系统版本 - Fedora29, 30 -- Centos6.5, 7.5 +- Centos6.5, Centos7.0~7.6 - Ubuntu16.04, 18.04 ### 需要的存储空间 @@ -34,6 +34,13 @@ bash> git clone https://github.com/vesoft-inc/nebula.git - 环境不能直接下载oss包的用户 步骤 1: + 从本地源下载依赖和进行配置 + + ``` + bash> cd nebula && ./build_dep.sh N + ``` + + 步骤 2: 从下面链接中下载对应版本的压缩包 **中国用户** @@ -51,7 +58,7 @@ bash> git clone https://github.com/vesoft-inc/nebula.git - [Ubuntu1604](https://nebula-graph-us.oss-us-west-1.aliyuncs.com/build-deb/ubuntu16.tar.gz) - [Ubuntu1804](https://nebula-graph-us.oss-us-west-1.aliyuncs.com/build-deb/ubuntu18.tar.gz) - 步骤 2: + 步骤 3: 安装下载好的压缩包 ``` @@ -59,13 +66,6 @@ bash> git clone https://github.com/vesoft-inc/nebula.git cd ${package_name} && ./install.sh ``` - Step 3: - 从本地源下载依赖和进行配置 - - ``` - bash> cd nebula && ./build_dep.sh N - ``` - #### 步骤 3: 应用 **~/.bashrc** 修改 ``` @@ -73,23 +73,12 @@ bash> source ~/.bashrc ``` #### 步骤 4: 构建 -- 不编译 java client - - ``` - bash> mkdir build && cd build - bash> cmake .. - bash> make - bash> sudo make install - ``` -- 编译 java client - - ``` - bash> mvn install:install-file -Dfile=/opt/nebula/third-party/fbthrift/thrift-1.0-SNAPSHOT.jar -DgroupId="com.facebook" -DartifactId="thrift" -Dversion="1.0-SNAPSHOT" -Dpackaging=jar - bash> mkdir build && cd build - bash> cmake -DSKIP_JAVA_CLIENT=OFF .. - bash> make - bash> sudo make install - ``` +``` +bash> mkdir build && cd build +bash> cmake .. +bash> make +bash> sudo make install +``` #### **构建完成** - 如果没有任何错误信息 @@ -216,3 +205,22 @@ nebula> SHOW HOSTS; export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH ``` + +- **错误信息**: `internal error` + + **解决方案**: + + 你需要自己编译第三方库,第三方库的安装路径为 **/opt/nebula/third-party** + + ``` + bash> wget https://nebula-graph-us.oss-us-west-1.aliyuncs.com/third-party/nebula-3rdparty.tar.gz + bash> tar xf nebula-3rdparty.tar.gz && cd nebula-3rdparty + bash> ./install_deps.sh + bash> sudo make + bash> cd nebula && ./build_dep.sh N + bash> source ~/.bashrc + bash> mkdir build && cd build + bash> cmake .. + bash> make + bash> sudo make install + ```