Le 08/05/2013 00:00, Jeff Squyres (jsquyres) a écrit :
> Sorry for the high latency reply.
>
> I thought about this quite a bit today.  Here's a thinking-out-of-the-box 
> question: should we just use the default/system installed libltdl instead of 
> embedding?

I don't have anything against this. What was the reason for not using
the default/system libltdl in OMPI? libtool was buggy when you started
using it?

> If we don't embed, many of these problems go away, right?

I think so.

> a) care about supporting plugins by default on distros with older ltdl 
> versions?
> b) use any functionality beyond libltdl 2.2.6?  (or some other 
> older/benchmark distro ltdl version that we care about supporting)

No to both.

> Attached is a patch that does a few minor things:
>
> - avoid the use of AM_CONDITIONAL for the libltdl subdir

That's nice thanks.

> - ensure to have libtool avoid setting up Fortran and C++ (a trick we learned 
> from MPICH :-) )

Is this related to ltdl anyhow?

> - disallow embedded mode and plugins (per our phone discussion the other day)
> - reorder the plugins support AC_MSG_RESULT to come before any WARN/ERROR 
> messages

I fixed 3 things in your patch (new version attached).
* typo in comment
* typo in SUBDIRS (HWLOC_LIBLTDL_SUBDIR vs HWLOC_LTDL_SUBDIR)
* moved back that SUBDIRS= line into if PLUGINS so that we don't build
ltdl when plugins is disabled
Aside from these, that looks good to me.

Brice


>
>
> On Apr 30, 2013, at 5:30 AM, Brice Goglin <brice.gog...@inria.fr> wrote:
>
>> Jeff,
>>
>> I've been working on making hwloc v1.7 pass our tests/embedded scripts
>> in the last days. I fixed some minor issues but here's the remaining
>> (big) one.
>>
>> First problem is that we need the AM_CONDITIONAL for HWLOC_LTDL_INCLUDED
>> to be executed when embedded. I can fix this by moving into
>> HWLOC_DO_AM_CONDITIONAL. But...
>>
>> We conditionally enable SUBDIRS=libltdl (in src/Makefile.am) when
>> plugins are enabled and the internal ltdl is used. Assuming embedders
>> don't want hwloc plugins, this builds fine since we don't enter libltdl
>> during "make", and we can avoid the (ugly) ltdl configuration entirely
>> [1]. But "make distclean" still enters libltdl unconditionally, and it
>> fails if LTDL wasn't configured because the Makefile is missing.
>>
>> For the record, you had a similar issue with doc/tests/tools where you
>> don't even have a Makefile.am in these directories in OMPI. You fixed it
>> by doing DIST_SUBDIRS=$(SUBDIRS). It means that distclean doesn't enter
>> those directories at all. But it also means that you don't get
>> doc/tests/tools in make dist when embedded is enabled. We don't build
>> hwloc tarballs in embedded mode so that's fine. Using the same idea for
>> my issue would require to build hwloc tarballs with plugins enabled and
>> ltld included (both non default), I don't thing we should to this way.
>>
>> So we need a way to have src/libltdl stay in DIST_SUBDIRS by default, go
>> in SUBDIRS when needed, and disappear totally when embedded. So here's
>> the only solution I finally found: hwloc configure.ac sets a shell
>> variable to yes, and a new AM_CONDITIONAL adds src/libltdl to
>> DIST_SUBDIRS only when this variable is "yes".
>> This still causes hwloc tarballs to contain libltdl (because hwloc
>> configure.ac sets the variable to yes). It's still enabled only when the
>> system doesn't have libltdl installed or --with-included-ltdl is given,
>> as previously. And embedders totally ignore src/libltdl, including in
>> distclean, because they don't set the variable to yes.
>>
>> If an embedder ever wants to use hwloc plugins, he will have to
>> duplicate what the hwloc configure.ac does [1], and it can still link
>> with another libltdl if needed (to be tested).
>>
>> Patch attached, on top of trunk. Note that you may need these additional
>> commits if you or Pavan want to test things [2]
>>
>> Let me know what you think because you have the same problem as Pavan
>> when OMPI switches to hwloc v1.6+
>>
>> Brice
>>
>>
>>
>>
>> [1] Enabling ltdl requires some code like below:configure.ac
>> AM_PROG_LIBTOOL([dlopen win32-dll])
>> LT_LANG([C])
>> # Here's what we need to configure ltdl properly
>> LT_CONFIG_LTDL_DIR([src/libltdl])
>> LTDL_INIT([recursive convenience])
>> AC_CONFIG_FILES([src/libltdl/Makefile])
>> # Tell src/Makefile.am that things were configured under src/libltdl/
>> hwloc_mayenter_src_libltdl=yes
>>
>> libtool doesn't seem to like having it in a HWLOC_SETUP_LTDL macro
>> outside of the main, and I think we have to let embedders call
>> AM_PROG_LIBTOOL() directly in case they need other options.
>>
>> There's also a hack below these lines that is specific to the
>> "recursive" mode, but we may switch to "subproject" mode  (hwloc
>> configure explicitly calls libltdl configure) at some point if libtool
>> doesn't fix the issue.
>>
>> [2]
>> https://svn.open-mpi.org/trac/hwloc/changeset/5563
>> https://svn.open-mpi.org/trac/hwloc/changeset/5562
>>
>> <ltdl.patch>
>

diff --git a/config/hwloc.m4 b/config/hwloc.m4
index de4d784..059b72e 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -1026,6 +1026,12 @@ EOF])
     AC_MSG_CHECKING([if plugin support is enabled])
     # Plugins (even core support) are totally disabled by default
     AS_IF([test "x$enable_plugins" = "x"], [enable_plugins=no])
+    AS_IF([test "x$enable_plugins" != "xno"], [hwloc_have_plugins=yes], [hwloc_have_plugins=no])
+    AC_MSG_RESULT([$hwloc_have_plugins])
+    AS_IF([test "x$hwloc_have_plugins" = "xyes"],
+          [AC_DEFINE([HWLOC_HAVE_PLUGINS], 1, [Define to 1 if the hwloc library should support dynamically-loaded plugins])])
+
+    # Some sanity checks about plugins
     # libltdl doesn't work on AIX as of 2.4.2
     AS_IF([test "x$enable_plugins" = "xyes" -a "x$hwloc_aix" = "xyes"],
       [AC_MSG_WARN([libltdl does not work on AIX, plugins support cannot be enabled.])
@@ -1034,11 +1040,12 @@ EOF])
     AS_IF([test "x$enable_plugins" = "xyes" -a "x$hwloc_windows" = "xyes"],
       [AC_MSG_WARN([Plugins not supported on non-native Windows build, plugins support cannot be enabled.])
        AC_MSG_ERROR([Cannot continue])])
-
-    AS_IF([test "x$enable_plugins" != "xno"], [hwloc_have_plugins=yes], [hwloc_have_plugins=no])
-    AC_MSG_RESULT([$hwloc_have_plugins])
-    AS_IF([test "x$hwloc_have_plugins" = "xyes"],
-          [AC_DEFINE([HWLOC_HAVE_PLUGINS], 1, [Define to 1 if the hwloc library should support dynamically-loaded plugins])])
+    # plugins are not supported in embedded mode (indeed, all the LTDL
+    # setup stuff is up in hwloc's private configure.ac -- not down
+    # here in hwloc.m4)
+    AS_IF([test "x$enable_plugins" = "xyes" -a "$hwloc_mode" = "embedded"],
+          [AC_MSG_WARN([Embedded mode not supported with plugins])
+           AC_MSG_ERROR([Cannot continue])])

     AC_ARG_WITH([hwloc-plugins-path],
 		AC_HELP_STRING([--with-hwloc-plugins-path=dir:...],
diff --git a/configure.ac b/configure.ac
index f05fd2d..95c95f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,9 @@ LIBS="$HWLOC_EMBEDDED_LIBS $LIBS"
 # Compiler support -- we don't need that stuff.
 AM_ENABLE_SHARED
 AM_DISABLE_STATIC
+FC=no
+F77=no
+CXX=no
 AM_PROG_LIBTOOL([dlopen win32-dll])
 LT_LANG([C])
 LT_CONFIG_LTDL_DIR([src/libltdl])
@@ -185,7 +188,11 @@ if test "x$hwloc_have_plugins" = xyes; then
 fi

 # Is ltdl included?
-AM_CONDITIONAL([HWLOC_LTDL_INCLUDED], [test "x$with_included_ltdl" = xyes])
+HWLOC_LTDL_SUBDIR=
+AS_IF([test "x$with_included_ltdl" = xyes],
+      [HWLOC_LIBLTDL_SUBDIR=libltdl])
+AC_SUBST(HWLOC_LIBLTDL_SUBDIR)
+dnl AM_CONDITIONAL([HWLOC_LTDL_INCLUDED], [test "x$with_included_ltdl" = xyes])


 # Party on
diff --git a/src/Makefile.am b/src/Makefile.am
index 320222c..f428149 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -208,9 +208,7 @@ AM_CPPFLAGS += $(LTDLINCL)
 libhwloc_la_LDFLAGS += -export-dynamic
 libhwloc_la_LIBADD = $(LIBLTDL)
 libhwloc_la_DEPENDENCIES = $(LTDLDEPS)
-if HWLOC_LTDL_INCLUDED
-SUBDIRS = libltdl
-endif
+SUBDIRS = $(HWLOC_LIBLTDL_SUBDIR)
 endif

 # Embedded library (note the lack of a .so version number -- that

Reply via email to