From ad36808b7d5316a724934e69dbd6dd5a725f0493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Thu, 20 Feb 2020 17:41:10 +0100 Subject: [PATCH] Make: add USE_LIBBACKTRACE flag --- Makefile | 11 ++++++++++- README.md | 6 ++++++ beacon_chain.nimble | 2 +- config.nims | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d5794f63a..4e9a04289 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,11 @@ endif # "--import" can't be added to config.nims, for some reason # "--define:release" implies "--stacktrace:off" and it cannot be added to config.nims either +ifeq ($(USE_LIBBACKTRACE), 0) +NIM_PARAMS := $(NIM_PARAMS) -d:debug -d:disable_libbacktrace +else NIM_PARAMS := $(NIM_PARAMS) -d:release --import:libbacktrace +endif #- the Windows build fails on Azure Pipelines if we have Unicode symbols copy/pasted here, # so we encode them in ASCII @@ -75,7 +79,10 @@ build-system-checks: }; \ exit 0 -deps: | deps-common beacon_chain.nims p2pd libbacktrace +deps: | deps-common beacon_chain.nims p2pd +ifneq ($(USE_LIBBACKTRACE), 0) +deps: | libbacktrace +endif #- deletes and recreates "beacon_chain.nims" which on Windows is a copy instead of a proper symlink update: | update-common @@ -130,7 +137,9 @@ testnet1: | build deps clean: | clean-common rm -rf build/{$(TOOLS_CSV),all_tests,*_node,*ssz*,beacon_node_testnet*,state_sim,transition*} +ifneq ($(USE_LIBBACKTRACE), 0) + $(MAKE) -C vendor/nim-libbacktrace clean $(HANDLE_OUTPUT) +endif libnfuzz.so: | build deps-common beacon_chain.nims echo -e $(BUILD_MSG) "build/$@" && \ diff --git a/README.md b/README.md index c04eb818c..aeba9ec51 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,12 @@ make NIMFLAGS="-d:release" make -j$(nproc) NIMFLAGS="-d:release" USE_MULTITAIL=yes eth2_network_simulation ``` +- don't use the [lightweight stack tracing implementation from nim-libbacktrace](https://github.com/status-im/nim-beacon-chain/pull/745): + +```bash +make USE_LIBBACKTRACE=0 # expect the resulting binaries to be 2-3 times slower +``` + ## License Licensed and distributed under either of diff --git a/beacon_chain.nimble b/beacon_chain.nimble index 1596109c2..248c663ef 100644 --- a/beacon_chain.nimble +++ b/beacon_chain.nimble @@ -42,7 +42,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "", lang var extra_params = params for i in 2..