From ec563f6126ceb427a7f9d1a81366a0514254200d Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 11 Feb 2015 13:41:22 -0800 Subject: [PATCH] libltdl: adjust rest of tree for embedded libltdl Adjust .gitignore for files that we should and should not ignore in the embedded opal/libltdl (and friends). Also make changes to autogen.pl: * Remove some old kruft about the preopen error diff patch and FreeBSD shenanigans * Update some configure ordering of CUDA libltdl checking to ensure that it happens after libltdl is setup * Set all the LTDL macros that our build system expects (i.e., that LTDL_INIT/libtoolize used to do for us, such as LIBLTDL, LTDLDEPS, LTDLINCL). * Adjust all inclusions of `ltdl.h` to now use `#include ` and simply set CPPFLAGS if we need it to point to the one embedded in the OMPI source tree. * Adjust autogen.pl to run "autoreconf" in the opal/libltdl tree. Critically, we need to NOT run `libtoolize`, though (there's complicated sequencing in the bootstrapping of the Libtool/libltdl packages that makes that magically work somehow -- but now we don't want that magic: we want libltdl to be just like any other embedded package that just needs a configure script and some Automake-ified Makefiles). --- .gitignore | 20 ++++++---- autogen.pl | 40 +++++++++---------- config/Makefile.am | 3 +- config/libltdl-preopen-error.diff | 27 ------------- config/opal_check_cuda.m4 | 32 ++++++++++++--- config/opal_setup_libltdl.m4 | 14 ++++++- configure.ac | 11 +++-- ompi/debuggers/dlopen_test.c | 6 ++- opal/Makefile.am | 10 ++--- opal/mca/base/mca_base_component_find.c | 8 +--- opal/mca/base/mca_base_component_repository.c | 8 +--- opal/util/lt_interface.c | 6 +-- 12 files changed, 92 insertions(+), 93 deletions(-) delete mode 100644 config/libltdl-preopen-error.diff diff --git a/.gitignore b/.gitignore index ec6546a8de9..d29b754cb66 100644 --- a/.gitignore +++ b/.gitignore @@ -80,12 +80,10 @@ missing mkinstalldirs libtool.m4 lt~obsolete.m4 -ltdl.m4 -argz.m4 -ltargz.m4 -ltsugar.m4 -ltversion.m4 -ltoptions.m4 + +config/ltoptions.m4 +config/ltsugar.m4 +config/ltversion.m4 config/project_list.m4 config/autogen_found_items.m4 @@ -163,6 +161,9 @@ ompi/mca/coll/sm/coll-sm-version.h* ompi/mca/crcp/ompi_crcp.7 ompi/mca/io/romio/io-romio-version.h* +ompi/mca/io/romio/romio/confdb/ltoptions.m4 +ompi/mca/io/romio/romio/confdb/ltsugar.m4 +ompi/mca/io/romio/romio/confdb/ltversion.m4 ompi/mca/io/romio/romio/lib ompi/mca/io/romio/romio/localdefs ompi/mca/io/romio/romio/adio/include/romioconf.h @@ -291,8 +292,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 @@ -306,6 +305,8 @@ opal/include/opal/sys/powerpc/atomic-32.s opal/include/opal/sys/powerpc/atomic-64.s opal/include/opal/sys/powerpc/atomic-32-64.s +opal/libltdl/config.h + opal/mca/base/mca_base_parse_paramfile_lex.c opal/mca/common/libfabric/libfabric/config.h @@ -318,6 +319,9 @@ opal/mca/crs/opal_crs.7 opal/mca/event/libevent*/libevent/config.h.in opal/mca/event/libevent*/libevent/config.h +opal/mca/event/libevent*/libevent/m4/ltoptions.m4 +opal/mca/event/libevent*/libevent/m4/ltsugar.m4 +opal/mca/event/libevent*/libevent/m4/ltversion.m4 opal/mca/event/libevent*/libevent/libevent.pc opal/mca/event/libevent*/libevent/libevent_openssl.pc opal/mca/event/libevent*/libevent/libevent_pthreads.pc diff --git a/autogen.pl b/autogen.pl index d680d32c76d..bf993e3e40a 100755 --- a/autogen.pl +++ b/autogen.pl @@ -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. @@ -1257,6 +1257,23 @@ sub patch_autotools_output { #--------------------------------------------------------------------------- +# Run autotools in libltdl +++$step; +verbose "\n$step. Running autotools on opal/libltdl\n\n"; + +chdir("opal/libltdl"); + +verbose "==> Running autoreconf\n"; +# Need to ensure that "libtoolize" isn't run +my %ENV_save = %ENV; +$ENV{LIBTOOLIZE} = "true"; +safe_system("autoreconf -ivf"); +%ENV = %ENV_save; + +chdir("../.."); + +#--------------------------------------------------------------------------- + # If we got here, all was good. Run the auto tools. ++$step; verbose "\n$step. Running autotools on top-level tree\n\n"; @@ -1265,7 +1282,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"; @@ -1292,26 +1308,6 @@ 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("."); - -#--------------------------------------------------------------------------- - verbose " ================================================ Open MPI autogen: completed successfully. w00t! diff --git a/config/Makefile.am b/config/Makefile.am index 3217f8fbfdf..5b534c77939 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -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. @@ -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 diff --git a/config/libltdl-preopen-error.diff b/config/libltdl-preopen-error.diff deleted file mode 100644 index 0112c746921..00000000000 --- a/config/libltdl-preopen-error.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- opal/libltdl/loaders/preopen.c.~1~ 2010-03-03 14:13:28.000000000 -0500 -+++ opal/libltdl/loaders/preopen.c 2010-03-05 17:57:11.000000000 -0500 -@@ -185,7 +185,24 @@ - } - } - -+#if 0 -+ /* Open MPI: This line is commented out because Open MPI does not -+ use the preopen functionality in libltdl at all -- so we never -+ need to see errors from this module. Additionally, this module -+ is usually invoked last in the sequence when trying to -+ lt_dlopenadvise() a DSO -- so if there was a real error when -+ opening that DSO (e.g., a symbol not found), setting the -+ FILE_NOT_FOUND error here will mask the real error. -+ -+ This error has been reported upstream to the Libtool maintainers; -+ they acknowledge that it is a problem but no one has come up with -+ a good general solution yet. This Open MPI-specific solution is -+ workable for us, but not workable as a general solution. Hence, -+ we patch in this "if 0" block in autogen.pl after Libtool -+ installs libltdl in the opal/ tree. -+ */ - LT__SETERROR (FILE_NOT_FOUND); -+#endif - - done: - return module; diff --git a/config/opal_check_cuda.m4 b/config/opal_check_cuda.m4 index f9af756ce2c..d5712d10abf 100644 --- a/config/opal_check_cuda.m4 +++ b/config/opal_check_cuda.m4 @@ -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 @@ -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"], @@ -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.])]) +]) diff --git a/config/opal_setup_libltdl.m4 b/config/opal_setup_libltdl.m4 index f89de1a19bf..e29ed43839e 100644 --- a/config/opal_setup_libltdl.m4 +++ b/config/opal_setup_libltdl.m4 @@ -9,7 +9,7 @@ dnl Copyright (c) 2004-2007 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) 2006-2008 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights dnl reserved. @@ -191,5 +191,17 @@ AC_DEFUN([_OPAL_SETUP_LIBLTDL_INTERNAL],[ fi CFLAGS=$CFLAGS_save + # These variables used to be set by libtoolize (when we had + # Libtool insertted at autogen time). But now we have a + # hard-coded/embeded version of libltdl from Libtool 2.4.2. And + # we don't use the embed-libltdl-at-libtoolize-time functionality + # any more. So we have to set these values ourselves. + LIBLTDL='${top_build_prefix}opal/libltdl/libltdlc.la' + LTDLDEPS=$LIBLTDL + LTDLINCL='-I${top_srcdir}/opal/libltdl' + AC_SUBST(LIBLTDL) + AC_SUBST(LTDLDEPS) + AC_SUBST(LTDLINCL) + OPAL_VAR_SCOPE_POP ])dnl diff --git a/configure.ac b/configure.ac index a1a3c4aa27b..6688b9653bd 100644 --- a/configure.ac +++ b/configure.ac @@ -867,6 +867,13 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m]) # -lrt might be needed for clock_gettime OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt]) +# See if we can find libltdl +OPAL_SETUP_LIBLTDL + +# Do some more CUDA checks after we determine whether we have libltdl +# support or not +OPAL_CHECK_CUDA_AFTER_LIBLTDL + AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv]) # Sanity check: ensure that we got at least one of statfs or statvfs. @@ -1225,8 +1232,6 @@ fi # a C++ compiler. AS_IF([test "$OMPI_WANT_FORTRAN_BINDINGS" != "1"],[F77=no FC=no]) -LT_CONFIG_LTDL_DIR([opal/libltdl], [subproject]) -LTDL_CONVENIENCE LT_INIT([dlopen win32-dll]) # What's the suffix of shared libraries? Inspired by generated @@ -1263,8 +1268,6 @@ esac AC_SUBST(OPAL_DYN_LIB_PREFIX) AC_SUBST(OPAL_DYN_LIB_SUFFIX) -OPAL_SETUP_LIBLTDL - # Need the libtool binary before the rpathify stuff LT_OUTPUT diff --git a/ompi/debuggers/dlopen_test.c b/ompi/debuggers/dlopen_test.c index 1cbbd79f588..6cd09c001fb 100644 --- a/ompi/debuggers/dlopen_test.c +++ b/ompi/debuggers/dlopen_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,9 @@ #include #include -#include "opal/libltdl/ltdl.h" +#if OPAL_WANT_LIBLTDL +#include +#endif #if !OPAL_WANT_LIBLTDL int main(int argc, char *argv[]) diff --git a/opal/Makefile.am b/opal/Makefile.am index 72201662981..73132aa9b17 100644 --- a/opal/Makefile.am +++ b/opal/Makefile.am @@ -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) 2009-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -30,12 +30,12 @@ SUBDIRS = \ . \ $(MCA_opal_FRAMEWORK_COMPONENT_DSO_SUBDIRS) -# libltdl is included by variable because if --disable-dlopen was -# used, there will be no generated Makefile in that directory (and -# therefore make distclean will fail). +# Note that if we were configured with --disable-dlopen or +# --with-libltdl=external, there will be no Makefile in libltdl/, and +# "make dist" will fail. DIST_SUBDIRS = \ include \ - $(LIBLTDL_SUBDIR) \ + libltdl \ asm \ datatype \ etc \ diff --git a/opal/mca/base/mca_base_component_find.c b/opal/mca/base/mca_base_component_find.c index 790a50c790d..edd7a2fd745 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -42,11 +42,7 @@ #endif #if OPAL_WANT_LIBLTDL - #if OPAL_LIBLTDL_INTERNAL - #include "opal/libltdl/ltdl.h" - #else - #include "ltdl.h" - #endif +#include #endif #include "opal/mca/installdirs/installdirs.h" diff --git a/opal/mca/base/mca_base_component_repository.c b/opal/mca/base/mca_base_component_repository.c index ea1108d400d..b380709de16 100644 --- a/opal/mca/base/mca_base_component_repository.c +++ b/opal/mca/base/mca_base_component_repository.c @@ -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) 2008-2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,11 +27,7 @@ #include #if OPAL_WANT_LIBLTDL - #if OPAL_LIBLTDL_INTERNAL - #include "opal/libltdl/ltdl.h" - #else - #include "ltdl.h" - #endif +#include #endif #include "opal/class/opal_list.h" diff --git a/opal/util/lt_interface.c b/opal/util/lt_interface.c index 59aa322b6e5..9dfbc6be909 100644 --- a/opal/util/lt_interface.c +++ b/opal/util/lt_interface.c @@ -16,11 +16,7 @@ #include "opal/util/output.h" #if OPAL_WANT_LIBLTDL - #if OPAL_LIBLTDL_INTERNAL - #include "opal/libltdl/ltdl.h" - #else - #include "ltdl.h" - #endif +#include #endif #if OPAL_WANT_LIBLTDL