From 8a54fe71e562aa824c84d1c4014b5086d207704b Mon Sep 17 00:00:00 2001 From: "Thomas R. W. Scogland" Date: Mon, 18 May 2015 15:08:55 -0700 Subject: [PATCH] resolved several hidden unresolved symbol errors Both the kvs and core libraries are now built with flags that require all of their symbols to resolve at link time for them rather than load time. This should probably be a requirement on every shared library we build, if only for debugging purposes. The other main change is that the flux command now detects when it is being invoked by a libtool run script, by checking the path for containing a .libs component, and adds an extra '../' in that case. This was the cause of the keygen error from the previous commit. --- src/bindings/lua/Makefile.am | 1 + src/cmd/Makefile.am | 4 ++-- src/cmd/flux.c | 9 ++++++--- src/common/Makefile.am | 9 +++++---- src/modules/kvs/Makefile.am | 5 ++++- src/modules/libmrpc/Makefile.am | 3 ++- src/modules/mecho/Makefile.am | 1 + src/modules/wreck/Makefile.am | 1 + 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/bindings/lua/Makefile.am b/src/bindings/lua/Makefile.am index b23a4ca7f7d3..c766b3251eca 100644 --- a/src/bindings/lua/Makefile.am +++ b/src/bindings/lua/Makefile.am @@ -35,6 +35,7 @@ flux_la_LIBADD = \ $(top_builddir)/src/common/libutil/libutil.la \ $(top_builddir)/src/common/libev/libev.la \ $(top_builddir)/src/common/liblsd/liblsd.la \ + -L$(top_builddir)/src/modules/kvs -lkvs -L$(top_builddir)/src/common -lflux-core \ $(JSON_LIBS) \ $(LIBZMQ) \ diff --git a/src/cmd/Makefile.am b/src/cmd/Makefile.am index c2f16ee93c8f..edaea9814ae7 100644 --- a/src/cmd/Makefile.am +++ b/src/cmd/Makefile.am @@ -12,12 +12,12 @@ AM_CPPFLAGS = \ -DMANDIR=\"$(mandir)\" fluxcmd_ldadd = \ - $(top_builddir)/src/modules/live/liblive.la \ - $(top_builddir)/src/modules/kvs/libkvs.la \ $(top_builddir)/src/common/libflux/libflux.la \ $(top_builddir)/src/common/libutil/libutil.la \ $(top_builddir)/src/common/liblsd/liblsd.la \ $(top_builddir)/src/common/libev/libev.la \ + -L$(top_builddir)/src/modules/live -llive \ + -L$(top_builddir)/src/modules/kvs -lkvs \ $(JSON_LIBS) $(LIBZMQ) $(LIBCZMQ) $(LIBMUNGE) $(LIBPTHREAD) $(LIBDL) LDADD = $(fluxcmd_ldadd) diff --git a/src/cmd/flux.c b/src/cmd/flux.c index 02c537526564..fc891b623303 100644 --- a/src/cmd/flux.c +++ b/src/cmd/flux.c @@ -74,7 +74,7 @@ static const struct option longopts[] = { static void usage (void) { - fprintf (stderr, + fprintf (stderr, "Usage: flux [OPTIONS] COMMAND ARGS\n" " -x,--exec-path PATH prepend PATH to command search path\n" " -M,--module-path PATH prepend PATH to module search path\n" @@ -270,8 +270,11 @@ char *intree_confdir (void) char *confdir = NULL; char *selfdir = dir_self (); - if (strcmp (selfdir, X_BINDIR) != 0) - confdir = xasprintf ("%s/../../etc/flux", selfdir); + if (strcmp (selfdir, X_BINDIR) != 0){ + confdir = xasprintf ("%s/%s../../etc/flux", + selfdir, + strstr(selfdir, "/.libs") != NULL ? "../" : ""); + } free (selfdir); return confdir; } diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 132ed6d23487..bab1cfaf098b 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -9,14 +9,15 @@ fluxlib_LTLIBRARIES = libflux-core.la libflux_core_la_SOURCES = libflux_core_la_LIBADD = \ $(builddir)/libflux/libflux.la \ - $(builddir)/libev/libev.la \ $(builddir)/liblsd/liblsd.la \ - $(builddir)/libzio/libzio.la \ $(builddir)/libutil/libutil.la \ + $(builddir)/libev/libev.la \ $(LIBMUNGE) $(JSON_LIBS) $(LIBZMQ) $(LIBCZMQ) $(LIBPTHREAD) $(LIBUTIL) \ - $(LIBDL) + $(LIBDL) -lrt +#-lrt is for clock_gettime, this should be abstracted libflux_core_la_LDFLAGS = -Wl,--version-script=$(srcdir)/version.map \ - -shared -export-dynamic --disable-static + -shared -export-dynamic --disable-static \ + -Wl,--no-undefined EXTRA_DIST = version.map diff --git a/src/modules/kvs/Makefile.am b/src/modules/kvs/Makefile.am index 56455769d550..c24855411972 100644 --- a/src/modules/kvs/Makefile.am +++ b/src/modules/kvs/Makefile.am @@ -35,11 +35,14 @@ libkvs_la_SOURCES = \ conf.c \ proto.c libkvs_la_LDFLAGS = -shared -export-dynamic --disable-static \ + -Wl,--no-undefined \ $(top_builddir)/src/common/libflux/libflux.la \ $(top_builddir)/src/common/libutil/libutil.la \ $(top_builddir)/src/common/libev/libev.la \ $(top_builddir)/src/common/liblsd/liblsd.la \ - $(LIBMUNGE) $(LIBDL) + -L$(top_builddir)/src/common -lflux-core + +#-lrt is for clock_gettime, this should be abstracted TESTS = \ test_waitqueue.t \ diff --git a/src/modules/libmrpc/Makefile.am b/src/modules/libmrpc/Makefile.am index b60d9204e529..b7027c52538d 100644 --- a/src/modules/libmrpc/Makefile.am +++ b/src/modules/libmrpc/Makefile.am @@ -4,8 +4,9 @@ AM_CPPFLAGS = \ $(JSON_CFLAGS) \ -I$(top_srcdir) -I$(top_srcdir)/src/include -noinst_LTLIBRARIES = libmrpc.la +fluxlib_LTLIBRARIES = libmrpc.la libmrpc_la_SOURCES = \ mrpc.c \ mrpc.h +libmrpc_la_LDFLAGS = -shared -export-dynamic diff --git a/src/modules/mecho/Makefile.am b/src/modules/mecho/Makefile.am index 1eef1c0b9178..0b09fb09b83a 100644 --- a/src/modules/mecho/Makefile.am +++ b/src/modules/mecho/Makefile.am @@ -12,6 +12,7 @@ fluxmod_LTLIBRARIES = mecho.la fluxmod_libadd = \ $(JSON_LIBS) $(LIBZMQ) $(LIBCZMQ) general_ldflags = --disable-static -avoid-version -shared -export-dynamic \ + $(top_builddir)/src/modules/libmrpc/libmrpc.la \ -L$(top_builddir)/src/common -lflux-core \ -L$(top_builddir)/src/modules/kvs -lkvs fluxmod_ldflags = -module \ diff --git a/src/modules/wreck/Makefile.am b/src/modules/wreck/Makefile.am index 35b8a680ba88..d4401b6483b7 100644 --- a/src/modules/wreck/Makefile.am +++ b/src/modules/wreck/Makefile.am @@ -32,6 +32,7 @@ fluxmod_libadd = \ fluxmod_ldflags = --disable-static -avoid-version -module -shared -export-dynamic \ -export-symbols-regex '^mod_(main|name)$$' \ + $(top_builddir)/src/modules/libmrpc/libmrpc.la \ -L$(top_builddir)/src/common -lflux-core \ -L$(top_builddir)/src/modules/kvs -lkvs