Make: add USE_LIBBACKTRACE flag

This commit is contained in:
Ștefan Talpalaru 2020-02-20 17:41:10 +01:00
parent 571818495f
commit ad36808b7d
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
4 changed files with 18 additions and 3 deletions

View File

@ -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/$@" && \

View File

@ -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

View File

@ -42,7 +42,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "", lang
var extra_params = params
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:./build/" & name & " -r -d:release --import:libbacktrace " & extra_params & " " & srcDir & name & ".nim" & " " & cmdParams
exec "nim " & lang & " --out:./build/" & name & " -r " & extra_params & " " & srcDir & name & ".nim" & " " & cmdParams
### tasks
task test, "Run all tests":

View File

@ -43,7 +43,7 @@ else:
if not defined(macosx):
# add debugging symbols and original files and line numbers
--debugger:native
if not (defined(windows) and defined(i386)):
if not (defined(windows) and defined(i386)) and not defined(disable_libbacktrace):
# light-weight stack traces using libbacktrace and libunwind
--define:nimStackTraceOverride
# "--import:libbacktrace" is added to NIM_PARAMS inside the Makefile,