fix libzstd-mt underlinking issue

fix #2045
When compiling `libzstd` in multithreading mode,
the `libzstd-mt` recipe would not include `-pthread`,
resulting in an underlinked dynamic library.

Added a test on Travis to check that the library is fully linked.

This makes it possible, in some future release,
to build a multi-threaded `libzstd` dynamic library by default
as it would no longer impact the build script of user programs.
This commit is contained in:
Yann Collet
2020-04-28 18:29:20 -07:00
parent f17ac423b2
commit c6ae2e83bc
2 changed files with 12 additions and 10 deletions
+9 -9
View File
@@ -154,9 +154,6 @@ libzstd.a: $(ZSTD_OBJ)
@echo compiling static library
@$(AR) $(ARFLAGS) $@ $^
libzstd.a-mt: CPPFLAGS += -DZSTD_MULTITHREAD
libzstd.a-mt: libzstd.a
ifneq (,$(filter Windows%,$(OS)))
LIBZSTD = dll\libzstd.dll
@@ -180,17 +177,20 @@ endif
libzstd : $(LIBZSTD)
libzstd-mt : CPPFLAGS += -DZSTD_MULTITHREAD
lib : libzstd.a libzstd
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
%-mt : LDFLAGS += -pthread
libzstd-mt : libzstd
lib: libzstd.a libzstd
libzstd.a-mt: libzstd.a
lib-mt: CPPFLAGS += -DZSTD_MULTITHREAD
lib-mt: lib
lib-mt : lib
lib-release lib-release-mt: DEBUGFLAGS :=
%-release : DEBUGFLAGS :=
lib-release: lib
lib-release-mt: lib-mt
lib-mt-release : lib-mt
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c
ZSTDMT_FILES = compress/zstdmt_compress.c