Commit c5353f8c authored by Ophélie Gagnard's avatar Ophélie Gagnard

WIP (debug): Use static libraries for fmt and openssl instead of shared libraries.

installation/metadata-collect-agent/Makefile: Add options for static libraries when a path is given for openssl or fmt respectively.
parent c8cb787e
...@@ -8,27 +8,38 @@ ifeq ($(INCLUDE_PYTHON),) # default behavior to get python includes path ...@@ -8,27 +8,38 @@ ifeq ($(INCLUDE_PYTHON),) # default behavior to get python includes path
INCLUDE_PYTHON=-I$(shell python3 -c "import sysconfig; print(sysconfig.get_path('include'))") INCLUDE_PYTHON=-I$(shell python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
endif endif
ifeq ($(FMTLIB_PATH),)
LDLIBS += -lfmt
endif
ifneq ($(FMTLIB_PATH),) ifneq ($(FMTLIB_PATH),)
INCLUDE_FMTLIB = -I$(FMTLIB_PATH)/include INCLUDE_FMTLIB = -I$(FMTLIB_PATH)/include
LIBRARY_FMTLIB = -L$(FMTLIB_PATH)/lib LIBRARY_FMTLIB = -L$(FMTLIB_PATH)/lib
RUNPATH_FMTLIB = -Wl,-rpath,$(FMTLIB_PATH)/lib #LDLIBS += -l:libfmt.a
LDLIBS += -lfmt
#RUNPATH_FMTLIB = -Wl,-rpath,$(FMTLIB_PATH)/lib
endif endif
#ifeq ($(LIBRARY_FMTLIB),)
# LIBRARY_FMTLIB = -lfmt
#endif
ifeq ($(OPENSSL_PATH),)
LDLIBS += -lcrypto
endif
ifneq ($(OPENSSL_PATH),) ifneq ($(OPENSSL_PATH),)
INCLUDE_OPENSSL = -I$(OPENSSL_PATH)/include INCLUDE_OPENSSL = -I$(OPENSSL_PATH)/include
LIBRARY_OPENSSL = -L$(OPENSSL_PATH)/lib LIBRARY_OPENSSL = -L$(OPENSSL_PATH)/lib
RUNPATH_OPENSSL = -Wl,-rpath,$(OPENSSL_PATH)/lib # note: -l:libssl.a is probably not needed
#LDLIBS += -l:libssl.a -l:libcrypto.a
LDLIBS += -lcrypto
#RUNPATH_OPENSSL = -Wl,-rpath,$(OPENSSL_PATH)/lib
endif endif
#ifeq ($(LIBRARY_OPENSSL),)
# LIBRARY_OPENSSL = -lcrypto
#endif
INCLUDE_DIRS = $(INCLUDE_PYTHON) $(INCLUDE_FMTLIB) $(INCLUDE_OPENSSL) #INCLUDE_DIRS = $(INCLUDE_PYTHON) $(INCLUDE_FMTLIB) $(INCLUDE_OPENSSL)
LIBRARY_DIRS = $(LIBRARY_FMTLIB) $(LIBRARY_OPENSSL) #LIBRARY_DIRS = $(LIBRARY_FMTLIB) $(LIBRARY_OPENSSL)
RUNPATHS = $(RUNPATH_FMTLIB) $(RUNPATH_OPENSSL) #RUNPATHS = $(RUNPATH_FMTLIB) $(RUNPATH_OPENSSL)
INCLUDE_DIRS = $(INCLUDE_PYTHON) $(INCLUDE_FMTLIB) $(INCLUDE_OPENSSL) -I$(ZLIB_PATH)/include
LIBRARY_DIRS = $(LIBRARY_FMTLIB) $(LIBRARY_OPENSSL) -L $(ZLIB_PATH)/lib
RUNPATHS = $(RUNPATH_FMTLIB) $(RUNPATH_OPENSSL) -Wl,-rpath,$(ZLIB_PATH)/lib
LDLIBS += -lz -ldl
# use of LD_LIBRARY_PATH is strongly discouraged # use of LD_LIBRARY_PATH is strongly discouraged
# # see for instance https://www.eyrie.org/~eagle/notes/rpath.html # # see for instance https://www.eyrie.org/~eagle/notes/rpath.html
...@@ -40,8 +51,7 @@ RUNPATHS = $(RUNPATH_FMTLIB) $(RUNPATH_OPENSSL) ...@@ -40,8 +51,7 @@ RUNPATHS = $(RUNPATH_FMTLIB) $(RUNPATH_OPENSSL)
CPPFLAGS = -pthread -Wformat -Werror=format-security CPPFLAGS = -pthread -Wformat -Werror=format-security
#-Wall -Wextra -Werror -Wno-unused-parameter #-Wall -Wextra -Werror -Wno-unused-parameter
#LDFLAGS += -Wl,--unresolved-symbols=ignore-all #LDFLAGS += -Wl,--unresolved-symbols=ignore-all
LDFLAGS = $(LIBRARY_DIRS) $(RUNPATHS) LDFLAGS = -static $(LIBRARY_DIRS) $(RUNPATHS)
LDLIBS = -lcrypto -lfmt
EXT_SUFFIX := $(shell python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))") EXT_SUFFIX := $(shell python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
EXT = $(EXE)$(EXT_SUFFIX) EXT = $(EXE)$(EXT_SUFFIX)
...@@ -57,6 +67,11 @@ dev: ...@@ -57,6 +67,11 @@ dev:
echo LDFLAGS = $(LDFLAGS) echo LDFLAGS = $(LDFLAGS)
echo TARGET_ARCH = $(TARGET_ARCH) echo TARGET_ARCH = $(TARGET_ARCH)
echo dev, others:
echo LDLIBS = $(LDLIBS)
echo LIBRARY_DIRS = $(LIBRARY_DIRS)
echo RUNPATHS = $(RUNPATHS)
%.cpp: %.pyx %.cpp: %.pyx
$(info "[Cython Compiling $^ -> $@]") $(info "[Cython Compiling $^ -> $@]")
@echo "[Cython Compiling $^ -> $@]" @echo "[Cython Compiling $^ -> $@]"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment