[ moving to the libtool-patches list from here: http://www.open-mpi.org/community/lists/devel/2010/08/8399.php ]
* Ralf Wildenhues wrote on Thu, Oct 14, 2010 at 08:56:19PM CEST: > this bug has been addressed in upstream Libtool commit > v2.2.6-59-gb7dbec6: > <http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=v2.2.6-59-gb7dbec6> > > It is not wholly fixed yet, but for all cases interesting to OpenMPI. > (A libtoolized package using only Fortran but no C compiler may still > have issues.) Not totally true; since C will be enabled by libtool anyway, we are fairly safe here (as the test will be run with the C compiler then, and not rerun with Fortran due to caching). However, we should fix setting hardcode_libdir_flag_spec for XL Fortran on GNU/Linux anyway, and for that we need to ensure $wl is unset in the shared library creation code in ltmain. The patch below does that and eliminates the need for hardcode_libdir_flag_spec_ld in the process. This should also help when hardcoding flags in programs created by this compiler. The idea is that, if $archive_cmds contains the string `$LD ' literally, then we are going to link with ld, and $wl can be nullified. Warning 1: this also nullifies $wl for all following tag variable expansions in the ltmain code. I *think* this is safe, as by this time all we're going to do is create a shared library; but I'm not 100% sure. (OTOH, the number of systems where $LD is used for linking is pretty low in practice by now.) Warning 2: we might be creating the library with either one of archive_cmds archive_expsym_cmds module_cmds module_expsym_cmds but the code only checks the former, rather the one that really will be selected later. Should I fix that, for future-proofness in case we ever have the case where module creation differs from archive creation in whether $LD is used directly for linking? (Sounds fairly remote, right?) Tested on GNU/Linux/ppc with the XL compiler suite, as well as on HP-UX 10.20 (no regressions in the latter). OK to commit and add Paul to THANKS? Thanks, Ralf Eliminate hardcode_libdir_flag_spec_ld tag variable. * libltdl/config/ltmain.m4sh (func_mode_link): Set $wl to empty if $LD is used for creating shared libraries. Do not use hardcode_libdir_flag_spec_ld any more. * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG) (_LT_LANG_F77_CONFIG, _LT_LANG_FC_CONFIG, _LT_SYS_DYNAMIC_LINKER) <hardcode_libdir_flag_spec_ld>: Remove all instances of the tag variable. (_LT_LINKER_SHLIBS) [linux, xlf] <hardcode_libdir_flag_spec>: Set variable, including ${wl}. Fixes hardcoding in programs created by XL Fortran on GNU/Linux. * NEWS, THANKS: Update. Report by Paul H. Hargrove. diff --git a/NEWS b/NEWS index d8d692e..9c12714 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,15 @@ New in 2.4.2 2010-12-??: git version 2.4.1a, Libtool team: - The bug that leaked developer tool paths into the release tarballs from ./bootstrap is fixed. +* Important incompatible changes: + + - The undocumented hardcode_libdir_flag_spec_ld tag variable has been + removed in favor of using hardcode_libdir_flag_spec with $wl set to empty. + +* Changes in supported systems or compilers: + + - Fixes for gfortran on Darwin, XL Fortran on GNU/Linux. + New in 2.4 2010-09-22: git version 2.2.11a, Libtool team: * New features: diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index af46cb8..aff8a1c 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -7237,6 +7237,11 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= @@ -7275,11 +7280,7 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index d8b3a4d..419ffe1 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4522,7 +4522,6 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -4773,8 +4772,7 @@ _LT_EOF xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ @@ -5171,7 +5169,6 @@ _LT_EOF fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes @@ -5613,9 +5610,6 @@ _LT_TAGDECL([], [no_undefined_flag], [1], _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], @@ -5773,7 +5767,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported @@ -7106,7 +7099,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no @@ -7239,7 +7231,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no