Skip to content

Commit

Permalink
Static link rocksdb into Nimbus.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhartnett committed Mar 19, 2024
1 parent a147ff7 commit 17c1ca3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ VERIF_PROXY_OUT_PATH ?= build/libverifproxy/
libnimbus.so \
libnimbus.a \
libbacktrace \
rocksdb \
dist-amd64 \
dist-arm64 \
dist-arm \
Expand Down Expand Up @@ -178,6 +179,8 @@ ifneq ($(USE_LIBBACKTRACE), 0)
deps: | libbacktrace
endif

deps: | rocksdb

ifneq ($(USE_MIRACL), 0)
NIM_PARAMS += -d:BLS_FORCE_BACKEND=miracl
endif
Expand Down Expand Up @@ -231,6 +234,10 @@ nimbus.nims:
libbacktrace:
+ $(MAKE) -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0

# nim-rocksdb
rocksdb:
+ vendor/nim-rocksdb/scripts/build_static_deps.sh

# builds and runs the nimbus test suite
test: | build deps
$(ENV_SCRIPT) nim test_rocksdb $(NIM_PARAMS) nimbus.nims
Expand Down
12 changes: 12 additions & 0 deletions config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,15 @@ if defined(windows) and defined(i386):
# nim-kzg shipping their own blst, nimbus-eth1 too.
# disable nim-kzg's blst
switch("define", "kzgExternalBlst")

# nim-rocksdb static linking
import std/os

const libsDir = currentSourcePath.parentDir() & "/vendor/nim-rocksdb/build/lib"
switch("define", "rocksdb_static_linking")
switch("gcc.linkerexe", "g++") # use the C++ linker profile because it's a C++ library
switch("dynlibOverride", "libz.a")
switch("dynlibOverride", "librocksdb.a")
switch("l", libsDir & "/librocksdb.a")
switch("l", libsDir & "/libz.a")
#switch("passL", "-s") # to reduce the binary size if needed
2 changes: 1 addition & 1 deletion vendor/nim-rocksdb

0 comments on commit 17c1ca3

Please sign in to comment.