[Gluster-devel] [PATCH 14/15] build: libraries must be in LDADD/LIBADD

Jan Engelhardt jengelh at inai.de
Tue Sep 25 16:41:12 UTC 2012


Libraries must not be listed in LDFLAGS, because _order is important_.
Details see
http://stackoverflow.com/questions/4241683/linker-flags-in-wrong-place
http://www.gentoo.org/proj/en/qa/asneeded.xml#doc_chap2_sect3

Signed-off-by: Jan Engelhardt <jengelh at inai.de>
---
 cli/src/Makefile.am                           |    5 +++--
 configure.ac                                  |    8 ++++----
 glusterfsd/src/Makefile.am                    |    4 ++--
 rpc/rpc-transport/socket/src/Makefile.am      |    4 ++--
 xlators/features/marker/utils/src/Makefile.am |    5 +++--
 xlators/mgmt/glusterd/src/Makefile.am         |    5 +++--
 6 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am
index 8b5a505..3930776 100644
--- a/cli/src/Makefile.am
+++ b/cli/src/Makefile.am
@@ -6,9 +6,10 @@ gluster_SOURCES = cli.c registry.c input.c cli-cmd.c cli-rl.c \
 
 gluster_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_LDADD)\
 		$(RLLIBS) $(top_builddir)/rpc/xdr/src/libgfxdr.la \
-		$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
+		$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
+		$(GF_GLUSTERFS_LIBS) $(LIBXML2_LIBS)
 
-gluster_LDFLAGS = $(GF_LDFLAGS) $(GF_GLUSTERFS_LDFLAGS) $(LIBXML2_LIBS)
+gluster_LDFLAGS = $(GF_LDFLAGS)
 noinst_HEADERS = cli.h cli-mem-types.h cli-cmd.h
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) \
diff --git a/configure.ac b/configure.ac
index d577dec..db32fee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,7 +469,7 @@ case $host_os in
 	GF_LDFLAGS=""
 	GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
 	GF_LDADD="${ARGP_STANDALONE_LDADD}"
-	GF_GLUSTERFS_LDFLAGS="-lnsl -lresolv -lsocket"
+	GF_GLUSTERFS_LIBS="-lnsl -lresolv -lsocket"
         BUILD_FUSE_CLIENT=no
         FUSE_CLIENT_SUBDIR=""
 	;;
@@ -481,7 +481,7 @@ case $host_os in
 	GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
 	GF_LDADD="${ARGP_STANDALONE_LDADD}"
 	if test "x$ac_cv_header_execinfo_h" = "xyes"; then
-	   GF_GLUSTERFS_LDFLAGS="-lexecinfo"
+	   GF_GLUSTERFS_LIBS="-lexecinfo"
 	fi
 	GF_FUSE_LDADD="-lperfuse"
 	BUILD_FUSE_CLIENT=yes
@@ -495,7 +495,7 @@ case $host_os in
 	GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}"
 	GF_LDADD="${ARGP_STANDALONE_LDADD}"
 	if test "x$ac_cv_header_execinfo_h" = "xyes"; then
-	   GF_GLUSTERFS_LDFLAGS="-lexecinfo"
+	   GF_GLUSTERFS_LIBS="-lexecinfo"
 	fi
 	BUILD_FUSE_CLIENT=no
 	;;
@@ -547,7 +547,7 @@ fi
 
 
 AC_SUBST(GF_HOST_OS)
-AC_SUBST(GF_GLUSTERFS_LDFLAGS)
+AC_SUBST([GF_GLUSTERFS_LIBS])
 AC_SUBST(GF_GLUSTERFS_CFLAGS)
 AC_SUBST(GF_CFLAGS)
 AC_SUBST(GF_LDFLAGS)
diff --git a/glusterfsd/src/Makefile.am b/glusterfsd/src/Makefile.am
index 541a4d9..722b0a4 100644
--- a/glusterfsd/src/Makefile.am
+++ b/glusterfsd/src/Makefile.am
@@ -4,8 +4,8 @@ glusterfsd_SOURCES = glusterfsd.c glusterfsd-mgmt.c
 glusterfsd_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
 	$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
 	$(top_builddir)/rpc/xdr/src/libgfxdr.la \
-	$(GF_LDADD)
-glusterfsd_LDFLAGS = $(GF_LDFLAGS) $(GF_GLUSTERFS_LDFLAGS)
+	$(GF_LDADD) $(GF_GLUSTERFS_LIBS)
+glusterfsd_LDFLAGS = $(GF_LDFLAGS)
 noinst_HEADERS = glusterfsd.h glusterfsd-mem-types.h
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) \
diff --git a/rpc/rpc-transport/socket/src/Makefile.am b/rpc/rpc-transport/socket/src/Makefile.am
index f1f256d..5f6dfe6 100644
--- a/rpc/rpc-transport/socket/src/Makefile.am
+++ b/rpc/rpc-transport/socket/src/Makefile.am
@@ -3,10 +3,10 @@ noinst_HEADERS = socket.h name.h
 rpctransport_LTLIBRARIES = socket.la
 rpctransportdir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/rpc-transport
 
-socket_la_LDFLAGS = -module -avoidversion -lssl
+socket_la_LDFLAGS = -module -avoidversion
 
 socket_la_SOURCES = socket.c name.c
-socket_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+socket_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -lssl
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) \
 	-I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src/ \
diff --git a/xlators/features/marker/utils/src/Makefile.am b/xlators/features/marker/utils/src/Makefile.am
index fd5a4f8..2d2aa73 100644
--- a/xlators/features/marker/utils/src/Makefile.am
+++ b/xlators/features/marker/utils/src/Makefile.am
@@ -4,9 +4,10 @@ gsyncd_PROGRAMS = gsyncd
 
 gsyncd_SOURCES = gsyncd.c procdiggy.c
 
-gsyncd_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+gsyncd_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
+	$(GF_GLUSTERFS_LIBS)
 
-gsyncd_LDFLAGS = $(GF_LDFLAGS) $(GF_GLUSTERFS_LDFLAGS)
+gsyncd_LDFLAGS = $(GF_LDFLAGS)
 
 noinst_HEADERS = procdiggy.h
 
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index de65c39..95d2aba 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -1,7 +1,7 @@
 xlator_LTLIBRARIES = glusterd.la
 xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt
 glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) "-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\""
-glusterd_la_LDFLAGS = -module -avoidversion $(LIBXML2_LIBS) -lcrypto
+glusterd_la_LDFLAGS = -module -avoidversion
 glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \
 	glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \
 	glusterd-store.c glusterd-handshake.c glusterd-pmap.c \
@@ -12,7 +12,8 @@ glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \
 
 glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
 		     $(top_builddir)/rpc/xdr/src/libgfxdr.la \
-		     $(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
+		     $(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
+		     $(LIBXML2_LIBS) -lcrypto
 
 noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \
 	glusterd-sm.h glusterd-store.h glusterd-mem-types.h \
-- 
1.7.10.4





More information about the Gluster-devel mailing list