new var: PARTIAL_STATIC_LINKING

This commit is contained in:
Ștefan Talpalaru 2020-10-08 21:39:40 +02:00
parent 4b662df1e9
commit c278412dbf
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 21 additions and 3 deletions

View File

@ -124,6 +124,14 @@ it comes to support.
`make USE_SYSTEM_NIM=1 test`
### PARTIAL_STATIC_LINKING
Statically link some libraries (currently libgcc\_s and libpcre). Defaults to 0.
This is useful when you can't statically link Glibc because you use NSS functions.
`make PARTIAL_STATIC_LINKING=1 beacon_node`
### LINK_PCRE
Link PCRE, defaults to 1.

View File

@ -30,13 +30,23 @@ ifdef LOG_LEVEL
NIM_PARAMS := $(NIM_PARAMS) -d:chronicles_log_level="$(LOG_LEVEL)"
endif
# statically link everything but libc
PARTIAL_STATIC_LINKING := 0
ifeq ($(PARTIAL_STATIC_LINKING), 1)
NIM_PARAMS := $(NIM_PARAMS) --passL:-static-libgcc
endif
# avoid a "libpcre.so.3: cannot open shared object file: No such file or directory" message, where possible
LINK_PCRE := 1
ifeq ($(LINK_PCRE), 1)
ifneq ($(OS), Windows_NT)
ifneq ($(strip $(shell uname)), Darwin)
NIM_PARAMS := $(NIM_PARAMS) -d:usePcreHeader --passL:\"-lpcre\"
endif
ifneq ($(strip $(shell uname)), Darwin)
ifeq ($(PARTIAL_STATIC_LINKING), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:usePcreHeader --passL:-l:libpcre.a
else
NIM_PARAMS := $(NIM_PARAMS) -d:usePcreHeader --passL:-lpcre
endif
endif
endif
endif