Skip to content

Commit

Permalink
Fix libsanlock build on Unubtu/Debian
Browse files Browse the repository at this point in the history
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 <nsoffer@redhat.com>
  • Loading branch information
nirs authored and teigland committed Jan 15, 2018
1 parent 6be1f4f commit c7fd1b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Expand Up @@ -101,15 +101,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)

Expand Down

0 comments on commit c7fd1b6

Please sign in to comment.