diff --git a/.github/workflows/rc.yml b/.github/workflows/rc.yml index 2869d6f3f64..c6fe00cdca8 100644 --- a/.github/workflows/rc.yml +++ b/.github/workflows/rc.yml @@ -43,7 +43,7 @@ jobs: - uses: ./.github/actions/tagname-action id: tag - name: package - run: ./package/package.sh -v ${{ steps.tag.outputs.tagnum }} -t RelWithDebInfo -r OFF -p ON -s TRUE + run: ./package/package.sh -v ${{ steps.tag.outputs.tagnum }} -t RelWithDebInfo -r OFF -p ON -s TRUE -k ON - name: output some vars run: | tar zcf ${{ env.CPACK_DIR }}/nebula-graph-${{ steps.tag.outputs.tagnum }}.tar.gz --exclude=${{ env.BUILD_DIR }} ./* diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c55196392..877974b7b48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/nebula) +include(BreakPadConfig) include(PlatformCheck) include(NebulaCMakeMacros) include(GeneralCMakeOptions) diff --git a/cmake/nebula/BreakPadConfig.cmake b/cmake/nebula/BreakPadConfig.cmake new file mode 100644 index 00000000000..e038a11cb00 --- /dev/null +++ b/cmake/nebula/BreakPadConfig.cmake @@ -0,0 +1,12 @@ +# Breakpad +if (ENABLE_BREAKPAD) + if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") + MESSAGE(FATAL_ERROR "Breakpad need debug info.") + endif() +endif() +if (NOT ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64") + set(ENABLE_BREAKPAD OFF) +endif() +if (ENABLE_BREAKPAD) + add_compile_options(-DENABLE_BREAKPAD=1) +endif() diff --git a/cmake/nebula/GeneralCMakeOptions.cmake b/cmake/nebula/GeneralCMakeOptions.cmake index 55583470f4d..aaf3f1ea0e6 100644 --- a/cmake/nebula/GeneralCMakeOptions.cmake +++ b/cmake/nebula/GeneralCMakeOptions.cmake @@ -18,6 +18,7 @@ option(ENABLE_COMPRESSED_DEBUG_INFO "Compress debug info to reduce binary si option(ENABLE_CLANG_TIDY "Enable clang-tidy if present" OFF) option(ENABLE_GDB_SCRIPT_SECTION "Add .debug_gdb_scripts section" OFF) option(DISABLE_CXX11_ABI "Whether to disable cxx11 abi" OFF) +option(ENABLE_BREAKPAD "Whether to enable breakpad" OFF) option(ENABLE_STANDALONE_VERSION "Enable standalone version build" OFF) get_cmake_property(variable_list VARIABLES) diff --git a/cmake/nebula/ThirdPartyConfig.cmake b/cmake/nebula/ThirdPartyConfig.cmake index e8a93a58cdd..3b7ef413eff 100644 --- a/cmake/nebula/ThirdPartyConfig.cmake +++ b/cmake/nebula/ThirdPartyConfig.cmake @@ -106,7 +106,7 @@ find_package(FLEX REQUIRED) find_package(LibLZMA REQUIRED) find_package(Fizz REQUIRED) find_package(Sodium REQUIRED) -if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64") +if (ENABLE_BREAKPAD) find_package(Breakpad REQUIRED) endif() diff --git a/docker/Dockerfile b/docker/Dockerfile index fb79d3ab60e..e640e27166b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,8 +6,8 @@ COPY . /home/nebula/BUILD RUN cd /home/nebula/BUILD/package \ && [[ -z "${VERSION}" ]] \ - && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF \ - || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF + && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \ + || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON FROM centos:7 as graphd diff --git a/package/package.sh b/package/package.sh index 20bdd62e787..24791a7251e 100755 --- a/package/package.sh +++ b/package/package.sh @@ -12,6 +12,7 @@ # -r: Whether to enable compressed debug info, default ON # -p: Whether to dump the symbols from binary by dump_syms # -c: Whether to enable console building, default ON +# -k: Whether to enable breakpad, default OFF # # usage: ./package.sh -v -n -s -c # @@ -35,8 +36,9 @@ dump_symbols="OFF" dump_syms_tool_dir= system_name= install_prefix=/usr/local/nebula +enable_breakpad="OFF" -while getopts v:n:s:b:d:t:r:p:j:c: opt; +while getopts v:n:s:b:d:t:r:p:j:c:k: opt; do case $opt in v) @@ -70,6 +72,9 @@ do p) dump_symbols=$OPTARG ;; + k) + enable_breakpad=$OPTARG + ;; ?) echo "Invalid option, use default arguments" ;; @@ -122,6 +127,7 @@ function _build_graph { -DENABLE_PACK_ONE=${package_one} \ -DENABLE_COMPRESSED_DEBUG_INFO=${enable_compressed_debug_info} \ -DENABLE_PACKAGE_TAR=${package_tar} \ + -DENABLE_BREAKPAD=${enable_breakpad} \ ${project_dir} if ! ( make -j ${jobs} ); then diff --git a/src/daemons/GraphDaemon.cpp b/src/daemons/GraphDaemon.cpp index 217ce7aa1f7..9beb7d955fb 100644 --- a/src/daemons/GraphDaemon.cpp +++ b/src/daemons/GraphDaemon.cpp @@ -33,7 +33,7 @@ using nebula::network::NetworkUtils; static void signalHandler(nebula::graph::GraphServer *graphServer, int sig); static Status setupSignalHandler(nebula::graph::GraphServer *graphServer); static void printHelp(const char *prog); -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) extern Status setupBreakpad(); #endif @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) status = setupBreakpad(); if (!status.ok()) { LOG(ERROR) << status; diff --git a/src/daemons/MetaDaemon.cpp b/src/daemons/MetaDaemon.cpp index 712b5ac10b7..c6a88cf6a7b 100644 --- a/src/daemons/MetaDaemon.cpp +++ b/src/daemons/MetaDaemon.cpp @@ -56,7 +56,7 @@ static std::unique_ptr gKVStore; static void signalHandler(apache::thrift::ThriftServer* metaServer, int sig); static void waitForStop(); static Status setupSignalHandler(apache::thrift::ThriftServer* metaServer); -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) extern Status setupBreakpad(); #endif @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) status = setupBreakpad(); if (!status.ok()) { LOG(ERROR) << status; diff --git a/src/daemons/SetupBreakpad.cpp b/src/daemons/SetupBreakpad.cpp index f36179f629a..6d0eae8d8e3 100644 --- a/src/daemons/SetupBreakpad.cpp +++ b/src/daemons/SetupBreakpad.cpp @@ -3,7 +3,7 @@ * This source code is licensed under Apache 2.0 License. */ -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) #include #include "common/base/StatusOr.h" diff --git a/src/daemons/StandAloneDaemon.cpp b/src/daemons/StandAloneDaemon.cpp index 5a8c2fe17aa..1e44e8a47bc 100644 --- a/src/daemons/StandAloneDaemon.cpp +++ b/src/daemons/StandAloneDaemon.cpp @@ -53,7 +53,7 @@ void printHelp(const char *prog); void stopAllDaemon(); static void signalHandler(int sig); static Status setupSignalHandler(); -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) extern Status setupBreakpad(); #endif @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) status = setupBreakpad(); if (!status.ok()) { LOG(ERROR) << status; diff --git a/src/daemons/StorageDaemon.cpp b/src/daemons/StorageDaemon.cpp index 5b22349b83d..873ee47399d 100644 --- a/src/daemons/StorageDaemon.cpp +++ b/src/daemons/StorageDaemon.cpp @@ -47,7 +47,7 @@ using nebula::network::NetworkUtils; static void signalHandler(nebula::storage::StorageServer *storageServer, int sig); static Status setupSignalHandler(nebula::storage::StorageServer *storageServer); -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) extern Status setupBreakpad(); #endif @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } -#if defined(__x86_64__) +#if defined(ENABLE_BREAKPAD) status = setupBreakpad(); if (!status.ok()) { LOG(ERROR) << status;