Skip to content

Commit

Permalink
libltdl: remove embedded libltdl
Browse files Browse the repository at this point in the history
Per #311, Libtool v2.4.4 exposes a bug in either Libtool
and/or autoreconf (after discussions with Libtool and Autoconf
maintainers, it's not clear which) when embedding libltdl.

After some discussion in the Open MPI community, we have decided to
both remove our embedded libltdl and (mostly) treat libltdl like any
other external library:

* If --disable-dlopen is specified, it behaves as it always has:
  libltdl support is wholly disabled, and all plugins are slurped into
  their higher-level libraries.
* If --enable-dlopen is specified, configure will abort if it cannot
  find proper libltdl support.
* If neither of these are specified, configure will behave differently
  between a developer build (i.e., where a .git directory is present
  in the source tree) and non-developer build:
  * In a developer build, --enable-dlopen is assumed (i.e., configure
    will abort if libltdl support cannot be found). --disable-dlopen
    must be specified if you do not have libltdl support.
  * In a non-developer build:
    * If configure finds libltdl support, it will behave as if
      --enable-dlopen was specified.
    * If configure does not find libltdl support, it will behave as if
      --disable-dlopen was specified.

The developer build behavior is because dlopen support is usually
highly valued (e.g., being able to repeatedly build individual
plugins), and libltdl-devel may not be installed by default on Linux
distros and OSX.  Hence, without this special developer-build
provision, developers may inadvertently build without dlopen support.

Fixes #311.
  • Loading branch information
jsquyres committed Feb 11, 2015
1 parent 08285c6 commit dd30ed4
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 306 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ ompi/tools/wrappers/mpicxx-wrapper-data.txt
ompi/tools/wrappers/mpif77-wrapper-data.txt
ompi/tools/wrappers/mpif90-wrapper-data.txt

opal/libltdl

opal/asm/atomic-asm.S
opal/asm/atomic-test
opal/asm/generated/atomic-*.s
Expand Down
23 changes: 14 additions & 9 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
University of Stuttgart. All rights reserved.
Copyright (c) 2004-2005 The Regents of the University of California.
All rights reserved.
Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2013 Intel, Inc. All rights reserved.
$COPYRIGHT$

Expand Down Expand Up @@ -83,18 +83,23 @@ developer's checkout, you have three main options:
Use of GNU Autoconf, Automake, and Libtool (and m4)
===================================================

This procedure is *ONLY* necessary if you are building from a
developer's tree. If you have an Open MPI distribution tarball, this
procedure is unnecessary -- you can (and should) skip reading this
section.
You need to read/care about this section *ONLY* if you are building
from a developer's tree (i.e., a Git clone of the Open MPI source
tree). If you have an Open MPI distribution tarball, the contents of
this section are optional -- you can (and probably should) skip
reading this section.

If you are building Open MPI from a developer's tree, you must first
install fairly recent versions of the GNU tools Autoconf, Automake,
and Libtool (and possibly GNU m4, because recent versions of Autoconf
have specific GNU m4 version requirements). The specific versions
required depend on if you are using the trunk or a release branch (and
which release branch you are using). The specific versions can be
found at:
have specific GNU m4 version requirements). Starting with Open MPI
v1.9, by default, your Libtool installation must also include libltdl
support (to include "developer" support, meaning that ltdl.h must be
available).

The specific versions required depend on if you are using the Git
master branch or a release branch (and which release branch you are
using). The specific versions can be found here:

http://www.open-mpi.org/source/building.php

Expand Down
46 changes: 16 additions & 30 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
University of Stuttgart. All rights reserved.
Copyright (c) 2004-2007 The Regents of the University of California.
All rights reserved.
Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved.
Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007 Myricom, Inc. All rights reserved.
Expand Down Expand Up @@ -812,19 +812,27 @@ INSTALLATION OPTIONS

--enable-dlopen
Build all of Open MPI's components as standalone Dynamic Shared
Objects (DSO's) that are loaded at run-time (this is the default).
Objects (DSO's) that are loaded at run-time. configure will abort
if proper DSO support cannot be found on the build system (i.e., the
GNU Libltdl library and header files).

The opposite of this option, --disable-dlopen, causes two things:

1. All of Open MPI's components will be built as part of Open MPI's
normal libraries (e.g., libmpi).
2. Open MPI will not attempt to open any DSO's at run-time.

Note that this option does *not* imply that OMPI's libraries will be
built as static objects (e.g., libmpi.a). It only specifies the
location of OMPI's components: standalone DSOs or folded into the
Open MPI libraries. You can control whether Open MPI's libraries
are build as static or dynamic via --enable|disable-static and
--enable|disable-shared.
Note that --disable-dlopen does *not* imply that OMPI's libraries
will be built as static objects (e.g., libmpi.a). It only specifies
the location of OMPI's components: standalone DSOs or folded into
the Open MPI libraries. You can control whether Open MPI's
libraries are build as static or dynamic via --enable|disable-static
and --enable|disable-shared.

If neither --enable-dlopen nor --disable-dlopen are specified, Open
MPI will enable dlopen support if it can find proper DSO support on
the build system, or behave as if --disable-dlopen was specified if
it cannot find proper DSO support on the build system.

--with-platform=FILE
Load configure options for the build from FILE. Options on the
Expand Down Expand Up @@ -1136,28 +1144,6 @@ MISCELLANEOUS SUPPORT LIBRARIES
hwloc can discover PCI devices and locality, which can be useful for
Open MPI in assigning message passing resources to MPI processes.

--with-libltdl(=value)
This option specifies where to find the GNU Libtool libltdl support
library. The following values are permitted:

internal: Use Open MPI's internal copy of libltdl.
external: Use an external libltdl installation (rely on default
compiler and linker paths to find it)
<no value>: Same as "internal".
<directory>: Specify the location of a specific libltdl
installation to use

By default (or if --with-libltdl is specified with no VALUE), Open
MPI will build and use the copy of libltdl that it has in its source
tree. However, if the VALUE is "external", Open MPI will look for
the relevant libltdl header file and library in default compiler /
linker locations. Or, VALUE can be a directory tree where the
libltdl header file and library can be found. This option allows
operating systems to include Open MPI and use their default libltdl
installation instead of Open MPI's bundled libltdl.

Note that this option is ignored if --disable-dlopen is specified.

--disable-libompitrace
Disable building the simple "libompitrace" library (see note above
about libompitrace)
Expand Down
16 changes: 1 addition & 15 deletions autogen.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
Expand Down Expand Up @@ -1265,7 +1265,6 @@ sub patch_autotools_output {
verbose "==> Remove stale files\n";
find_and_delete(qw/config.guess config.sub depcomp compile install-sh ltconfig
ltmain.sh missing mkinstalldirs libtool/);
system("rm -rf opal/libltdl");

# Remove the old m4 file and write the new one
verbose "==> Writing m4 file with autogen.pl results\n";
Expand All @@ -1292,22 +1291,9 @@ sub patch_autotools_output {

#---------------------------------------------------------------------------

# For FreeBSD (carried over from autogen.sh); apparently some versions
# of automake don't so this (prior to 1.9.7...?).
system("chmod u+w opal/libltdl/configure");

#---------------------------------------------------------------------------

++$step;
verbose "\n$step. Patching autotools output on top-level tree :-(\n\n";

# Patch preopen error in libltdl
if (-f "opal/libltdl/loaders/preopen.c") {
verbose "=== Patching preopen error masking in libltdl\n";
safe_system("$patch_prog -N -p0 < config/libltdl-preopen-error.diff");
unlink("opal/libltdl/loaders/preopen.c.rej");
}

patch_autotools_output(".");

#---------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
# Copyright (c) 2014 Intel, Inc. All rights reserved.
Expand All @@ -23,7 +23,6 @@
EXTRA_DIST = \
distscript.csh \
opal_get_version.m4sh \
libltdl-preopen-error.diff \
ltmain_pgi_tp.diff \
opal_mca_priority_sort.pl

Expand Down
27 changes: 0 additions & 27 deletions config/libltdl-preopen-error.diff

This file was deleted.

32 changes: 27 additions & 5 deletions config/opal_check_cuda.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 IBM Corporation. All rights reserved.
dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
Expand Down Expand Up @@ -72,10 +72,11 @@ AS_IF([test "$with_cuda" = "no" || test "x$with_cuda" = "x"],
opal_cuda_incdir="$with_cuda/include"
AC_MSG_RESULT([found ($opal_cuda_incdir/cuda.h)])])])])])

# We cannot have CUDA support without dlopen support. Check for that and
# error out if the user has also set --disable-dlopen.
AS_IF([test "$enable_dlopen" = "no" && test "$opal_check_cuda_happy" = "yes"],
[AC_MSG_ERROR([--with-cuda cannot be used with --disable-dlopen. Remove one of them and reconfigure.])])
dnl We cannot have CUDA support without dlopen support. HOWEVER, we
dnl have not determined whether we have libltdl support yet (i.e.,
dnl whether we have dlopen support or not). So we have to defer this
dnl check until later (see the OPAL_CHECK_CUDA_AFTER_LIBLTDL m4 macro,
dnl below). :-(

# If we have CUDA support, check to see if we have CUDA 4.1 support
AS_IF([test "$opal_check_cuda_happy"="yes"],
Expand Down Expand Up @@ -142,3 +143,24 @@ AC_DEFINE_UNQUOTED([OPAL_CUDA_GDR_SUPPORT],$CUDA_VERSION_60_OR_GREATER,
[Whether we have CUDA GDR support available])

])

dnl
dnl CUDA support requires libltdl support. But we do not check for
dnl libltdl support until lafter the initial OPAL_CHECK_CUDA is called.
dnl So put the CUDA+libltdl check in a separate macro that can be called
dnl after the main libltdl check in the top-level configure.ac.
dnl
AC_DEFUN([OPAL_CHECK_CUDA_AFTER_LIBLTDL],[

# We cannot have CUDA support without dlopen support. When this
# macro is invoked, we will know if we have libltdl (i.e., dlopen)
# support.

# Error out if the user wants CUDA but we do not have libltdl
# support.
AS_IF([test $OPAL_ENABLE_DLOPEN_SUPPORT -eq 0 && \
test "$opal_check_cuda_happy" = "yes"],
[AC_MSG_WARN([--with-cuda was specified, but dlopen support has been disabled.])
AC_MSG_WARN([You must enable dlopen support and reconfigure.])
AC_MSG_ERROR([Cannot continue.])])
])
12 changes: 8 additions & 4 deletions config/opal_configure_options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 IBM Corporation. All rights reserved.
dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
Expand Down Expand Up @@ -294,13 +294,17 @@ AC_ARG_ENABLE([dlopen],
Disabling dlopen implies --disable-mca-dso.
(default: enabled)])])
if test "$enable_dlopen" = "no" ; then
enable_mca_dso="no"
enable_mca_static="yes"
OPAL_ENABLE_DLOPEN_SUPPORT=0
AC_MSG_RESULT([no])
else
elif test "$enable_dlopen" = "yes"; then
OPAL_ENABLE_DLOPEN_SUPPORT=1
AC_MSG_RESULT([yes])
elif test $OPAL_DEVEL -eq 1; then
OPAL_ENABLE_DLOPEN_SUPPORT=1
AC_MSG_RESULT([yes (devel build default)])
else
OPAL_ENABLE_DLOPEN_SUPPORT=-1
AC_MSG_RESULT([if available])
fi


Expand Down
Loading

0 comments on commit dd30ed4

Please sign in to comment.