Skip to content

Commit

Permalink
Disable breakpad in no-release version (#3533)
Browse files Browse the repository at this point in the history
* Disable breakpad in debug mode.

* Add option to enable breakpad.

* Fix package script.

* Enable breakpad in release only.

* Setup standalone.

* Check in cmake.

* Fix checking logical

* Fix macro.

* Control by macro.
  • Loading branch information
Shylock-Hg authored Mar 24, 2022
1 parent 46e1527 commit 456a28f
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} ./*
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions cmake/nebula/BreakPadConfig.cmake
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions cmake/nebula/GeneralCMakeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/nebula/ThirdPartyConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion package/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version> -n <ON/OFF> -s <TRUE/FALSE> -c <ON/OFF>
#
Expand All @@ -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)
Expand Down Expand Up @@ -70,6 +72,9 @@ do
p)
dump_symbols=$OPTARG
;;
k)
enable_breakpad=$OPTARG
;;
?)
echo "Invalid option, use default arguments"
;;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/daemons/GraphDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/daemons/MetaDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static std::unique_ptr<nebula::kvstore::KVStore> 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

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/daemons/SetupBreakpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This source code is licensed under Apache 2.0 License.
*/

#if defined(__x86_64__)
#if defined(ENABLE_BREAKPAD)
#include <breakpad/client/linux/handler/exception_handler.h>

#include "common/base/StatusOr.h"
Expand Down
4 changes: 2 additions & 2 deletions src/daemons/StandAloneDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/daemons/StorageDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
Expand Down

0 comments on commit 456a28f

Please sign in to comment.