From 4ffe8b8dc95df62e4c65e987eba6aa4a0c247fdc Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 14 Mar 2018 12:10:10 -0500 Subject: [PATCH] more makefile fixes --- ...ix-libsanlock-build-on-Unubtu-Debian.patch | 40 +++++++++++++++++++ ...ags.patch => 0002-fix-makefile-flags.patch | 8 ++-- sanlock.spec | 6 ++- 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 0001-Fix-libsanlock-build-on-Unubtu-Debian.patch rename 0001-fix-makefile-flags.patch => 0002-fix-makefile-flags.patch (93%) diff --git a/0001-Fix-libsanlock-build-on-Unubtu-Debian.patch b/0001-Fix-libsanlock-build-on-Unubtu-Debian.patch new file mode 100644 index 0000000..79605e4 --- /dev/null +++ b/0001-Fix-libsanlock-build-on-Unubtu-Debian.patch @@ -0,0 +1,40 @@ +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 + diff --git a/0001-fix-makefile-flags.patch b/0002-fix-makefile-flags.patch similarity index 93% rename from 0001-fix-makefile-flags.patch rename to 0002-fix-makefile-flags.patch index 88d1b00..6fd80aa 100644 --- a/0001-fix-makefile-flags.patch +++ b/0002-fix-makefile-flags.patch @@ -1,7 +1,7 @@ -From cf1a6ed9116187305b4592b1b2d7c5e246dac301 Mon Sep 17 00:00:00 2001 +From fa6d48a7c8991b2251e50469a7e57058be226ab0 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 14 Mar 2018 11:49:35 -0500 -Subject: [PATCH] fix makefile flags +Subject: [PATCH 2/2] fix makefile flags should let the fedora build flags work --- @@ -24,10 +24,10 @@ index c61348a2b9c3..04a23032614a 100644 all: $(TARGET1) $(TARGET2) diff --git a/src/Makefile b/src/Makefile -index 1ef6852aedf7..1d03784edf1e 100644 +index 73a2b3498475..14c0a53e6aeb 100644 --- a/src/Makefile +++ b/src/Makefile -@@ -99,24 +99,23 @@ VER=$(shell cat ../VERSION) +@@ -94,24 +94,23 @@ VER=$(shell cat ../VERSION) CFLAGS += -DVERSION=\"$(VER)\" CMD_CFLAGS = $(CFLAGS) -fPIE -DPIE diff --git a/sanlock.spec b/sanlock.spec index 8fb640f..042b8fb 100644 --- a/sanlock.spec +++ b/sanlock.spec @@ -27,14 +27,16 @@ Requires(postun): systemd-units %endif Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz -Patch0: 0001-fix-makefile-flags.patch +Patch0: 0001-Fix-libsanlock-build-on-Unubtu-Debian.patch +Patch1: 0002-fix-makefile-flags.patch %description The sanlock daemon manages leases for applications on hosts using shared storage. %prep %setup -q -%patch0 -p1 -b .0001-fix-makefile-flags.patch +%patch0 -p1 -b .0001-Fix-libsanlock-build-on-Unubtu-Debian.patch +%patch1 -p1 -b .0002-fix-makefile-flags.patch %build %set_build_flags