diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-03-08 14:44:50 -0500 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-03-21 11:18:51 -0400 |
commit | f21fd308fcfab6151e7c8f60642d8dfcbec0cc48 (patch) | |
tree | fd68b719a2e7c6a400ad86dabbcfaa8d05ad96eb | |
parent | 2f560dbc78360f0e7fa76a2dfdabd9c92d13e976 (diff) |
build: libgfxdr.so calls GF_FREE(), needs to link with -lglusterfs
The previous change to remove the xdrgen script exposed (or
created) a recursive build dependency: libglusterfs needs the
generated headers, and libgfxdr should be linked with libglusterfs
for GF_FREE/__gf_free.
(Much grumbling about libglusterfs being the kitchen sink of gluster
elided. This would not be necessary if there were two or more libs,
a gluster "runtime" library with common gluster code shared by the
xlators and daemons, and a utility library with things like the
rbtree, memory allocation, and whatnot.)
So. Link at build time or link at runtime? For truth-and-beauty, link
with libglusterfs.so at build time. Without truth-and-beauty, don't
link with libglusterfs and rely on the other things that link with
libglusterfs to provide resolution of __gf_free().
Truth-and-beauty it is. But how to generate the headers first, then
build libglusterfs, then come back and build libgfxdr? Autotools is a
maze of twisty passages, all different. Things that work with gnu
make on linux don't work with the BSD make. Finally I hit on this
solution. Add a shadow directory where make only generates the headers,
then build libglusterfs using the generated headers, and finally build
libgfxdr and link with libglusterfs.
See original BZ 1330604
change http://review.gluster.org/14085
Change-Id: Iede8a30e3103176cb8f0b054885f30fcb352492b
BUG: 1429696
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/16873
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | rpc/xdr/gen/Makefile.am | 48 | ||||
-rw-r--r-- | rpc/xdr/src/Makefile.am | 57 |
4 files changed, 61 insertions, 48 deletions
diff --git a/Makefile.am b/Makefile.am index bc4627e9f54..39192db672a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ + EXTRA_DIST = autogen.sh \ COPYING-GPLV2 COPYING-LGPLV3 \ INSTALL README.md AUTHORS THANKS NEWS \ @@ -9,7 +10,7 @@ EXTRA_DIST = autogen.sh \ contrib/uuid \ $(shell find $(top_srcdir)/tests -type f -print) -SUBDIRS = $(ARGP_STANDALONE_DIR) rpc/xdr/src libglusterfs rpc api xlators \ +SUBDIRS = $(ARGP_STANDALONE_DIR) rpc/xdr/gen libglusterfs rpc api xlators \ glusterfsd $(FUSERMOUNT_SUBDIR) doc extras cli heal \ @SYNCDAEMON_SUBDIR@ @UMOUNTD_SUBDIR@ tools events diff --git a/configure.ac b/configure.ac index 6d9013d539b..cc723bfba16 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,7 @@ AC_CONFIG_FILES([Makefile rpc/rpc-transport/rdma/src/Makefile rpc/xdr/Makefile rpc/xdr/src/Makefile + rpc/xdr/gen/Makefile xlators/Makefile xlators/meta/Makefile xlators/meta/src/Makefile diff --git a/rpc/xdr/gen/Makefile.am b/rpc/xdr/gen/Makefile.am new file mode 100644 index 00000000000..fc6973c1821 --- /dev/null +++ b/rpc/xdr/gen/Makefile.am @@ -0,0 +1,48 @@ +XDRGENFILES = glusterfs3-xdr.x cli1-xdr.x nlm4-xdr.x nsm-xdr.x \ + rpc-common-xdr.x glusterd1-xdr.x acl3-xdr.x portmap-xdr.x \ + mount3udp.x changelog-xdr.x glusterfs-fops.x +XDRHEADERS = $(XDRGENFILES:.x=.h) +XDRSOURCES = $(XDRGENFILES:.x=.c) + +CLEANFILES = $(XDRSOURCES) $(XDRHEADERS) + +# trick automake into doing BUILT_SOURCES magic +BUILT_SOURCES = $(XDRHEADERS) $(XDRSOURCES) + +xdrsrc=$(top_srcdir)/rpc/xdr/src + +# make's dependency resolution may mean that it decides to run +# rpcgen again (unnecessarily), but as the .c file already exists, +# rpcgen will exit with an error, resulting in a build error. We +# could use a '-' (i.e. -@rpcgen ...) and suffer with noisy warnings +# in the build. Or we do this crufty thing instead. +$(XDRSOURCES): $(XDRGENFILES) + if [ ! -e $@ -o $(@:.c=.x) -nt $@ ]; then \ + rpcgen -c -o $(@:.c=.tmp) $(@:.c=.x) && mv $(@:.c=.tmp) $@ ; \ + cp $@ $(xdrsrc)/ ;\ + fi + +# d*mn sed in netbsd6 doesn't do -i (inline) +# (why are we still running smoke on netbsd6 and not netbsd7?) +$(XDRHEADERS): $(XDRGENFILES) + if [ ! -e $@ -o $(@:.h=.x) -nt $@ ]; then \ + rpcgen -h -o $(@:.h=.tmp) $(@:.h=.x) ; \ + sed -e '/#ifndef/ s/-/_/g' -e '/#define/ s/-/_/g' -e '/#endif/ s/-/_/' \ + $(@:.h=.tmp) > $@ && rm -f $(@:.h=.tmp) ; \ + cp $@ $(xdrsrc)/ ; \ + fi + + +# link .x files when doing out-of-tree builds +# have to use .PHONY here to force it; all versions of make +# will think the file already exists "here" by virtue of the +# VPATH. And we have to have the .x file in $cwd in order to +# have rpcgen generate "nice" #include directives +# i.e. (nice): +# #include "acl3-xdr.h" +# versus (not nice): +# #include "../../../../foo/src/rpc/xdr/src/acl3-xdr.h" +.PHONY : $(XDRGENFILES) +$(XDRGENFILES): + @if [ ! -e $@ ]; then ln -s $(xdrsrc)/$@ . ; fi; + diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 10487e27664..2f3a6cc1005 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -1,8 +1,10 @@ -XDRSOURCES = glusterfs3-xdr.c cli1-xdr.c nlm4-xdr.c nsm-xdr.c \ - rpc-common-xdr.c glusterd1-xdr.c acl3-xdr.c portmap-xdr.c \ - mount3udp.c changelog-xdr.c glusterfs-fops.c -XDRHEADERS = $(XDRSOURCES:.c=.h) -XDRGENFILES = $(XDRSOURCES:.c=.x) +XDRGENFILES = glusterfs3-xdr.x cli1-xdr.x nlm4-xdr.x nsm-xdr.x \ + rpc-common-xdr.x glusterd1-xdr.x acl3-xdr.x portmap-xdr.x \ + mount3udp.x changelog-xdr.x glusterfs-fops.x +XDRHEADERS = $(XDRGENFILES:.x=.h) +XDRSOURCES = $(XDRGENFILES:.x=.c) + +EXTRA_DIST = $(XDRGENFILES) lib_LTLIBRARIES = libgfxdr.la @@ -12,7 +14,7 @@ libgfxdr_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \ -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/rpc/rpc-lib/src \ -I$(top_builddir)/rpc/xdr/src -# libgfxdr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la +libgfxdr_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la libgfxdr_la_LDFLAGS = -version-info $(LIBGFXDR_LT_VERSION) @@ -20,48 +22,9 @@ libgfxdr_la_SOURCES = xdr-generic.c xdr-nfs3.c msg-nfs3.c nodist_libgfxdr_la_SOURCES = $(XDRSOURCES) libgfxdr_la_HEADERS = xdr-generic.h xdr-nfs3.h msg-nfs3.h glusterfs3.h \ - rpc-pragmas.h $(XDRHEADERS) + rpc-pragmas.h +nodist_libgfxdr_la_HEADERS = $(XDRHEADERS) libgfxdr_ladir = $(includedir)/glusterfs/rpc -# trick automake into doing BUILT_SOURCES magic -BUILT_SOURCES = $(XDRHEADERS) - -EXTRA_DIST = $(XDRGENFILES) - CLEANFILES = $(XDRSOURCES) $(XDRHEADERS) - -xdrsrc=$(top_srcdir)/rpc/xdr/src - -# make's dependency resolution may mean that it decides to run -# rpcgen again (unnecessarily), but as the .c file already exists, -# rpcgen will exit with an error, resulting in a build error. We -# could use a '-' (i.e. -@rpcgen ...) and suffer with noisy warnings -# in the build. Or we do this crufty thing instead. -$(XDRSOURCES): $(XDRHEADERS) - @if [ ! -e $@ -o $(@:.c=.x) -nt $@ ]; then \ - rpcgen -c -o $(@:.c=.tmp) $(@:.c=.x) && mv $(@:.c=.tmp) $@ ; \ - fi - -# d*mn sed in netbsd6 doesn't do -i (inline) -# (why are we still running smoke on netbsd6 and not netbsd7?) -$(XDRHEADERS): $(XDRGENFILES) - @if [ ! -e $@ -o $(@:.h=.x) -nt $@ ]; then \ - rpcgen -h -o $(@:.h=.tmp) $(@:.h=.x) ; \ - sed -e '/#ifndef/ s/-/_/g' -e '/#define/ s/-/_/g' -e '/#endif/ s/-/_/' \ - $(@:.h=.tmp) > $@ && rm -f $(@:.h=.tmp) ; \ - fi - -# link .x files when doing out-of-tree builds -# have to use .PHONY here to force it; all versions of make -# will think the file already exists "here" by virtue of the -# VPATH. And we have to have the .x file in $cwd in order to -# have rpcgen generate "nice" #include directives -# i.e. (nice): -# #include "acl3-xdr.h" -# versus (not nice): -# #include "../../../../foo/src/rpc/xdr/src/acl3-xdr.h" -.PHONY : $(XDRGENFILES) -$(XDRGENFILES): - @if [ ! -e $@ ]; then ln -s $(xdrsrc)/$@ . ; fi; - |