From 39b4d87397e5a09adcd100e0f379f34d5dde7e9b Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Mon, 15 Jan 2018 01:21:51 +0200 Subject: [PATCH 1/2] Fix libsanlock build on Unubtu/Debian LIB_ENTIRE_LDFLAGS included libraries (e.g. -laio -lblkid) instead of linker flags. The libraries should be in LIB_ENTIRE_LDDADD and come *after* the sources. Otherwisae, the libraries are not linked, and loading libsanlock.so fail with undefined symbol error. Signed-off-by: Nir Soffer --- src/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 69fcd1321ee7..73a2b3498475 100644 --- a/src/Makefile +++ b/src/Makefile @@ -98,15 +98,15 @@ CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE CMD_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie CMD_LDADD += -lpthread -luuid -lrt -laio -lblkid -lsanlock -L../wdmd -lwdmd -LIB_ENTIRE_LDFLAGS += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd LIB_ENTIRE_LDFLAGS += -Wl,-z,relro -pie +LIB_ENTIRE_LDADD += -lpthread -lrt -laio -lblkid -L../wdmd -lwdmd LIB_CLIENT_LDFLAGS += -Wl,-z,relro -pie all: $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(CMD_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET) $(LIBSO_ENTIRE_TARGET): $(LIB_ENTIRE_SOURCE) - $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ + $(CC) $(CFLAGS) $(LIB_ENTIRE_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_ENTIRE_TARGET).so.$(SOMAJOR) $^ $(LIB_ENTIRE_LDADD) ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so ln -sf $(LIBSO_ENTIRE_TARGET) $(LIB_ENTIRE_TARGET).so.$(SOMAJOR) -- 2.7.5