Skip to content

Commit

Permalink
Recompile the new third-party library (#1083)
Browse files Browse the repository at this point in the history
* modify build dep

* Add missing packages

* clean installed third-party

* Modify docs

* update docs

* rebase upstream
  • Loading branch information
laura-ding authored and sherman-the-tank committed Jan 23, 2020
1 parent f75f49c commit 0101273
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 238 deletions.
210 changes: 24 additions & 186 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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}")
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
60 changes: 34 additions & 26 deletions docs/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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**
Expand All @@ -55,45 +62,27 @@ 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
```
tar xf ${package_name}.tar.gz
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
Expand Down Expand Up @@ -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
```
Loading

0 comments on commit 0101273

Please sign in to comment.