Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] hwloc embedding vs libltdl
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2013-04-30 05:30:36


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