fortran: fix linking with Fortran sentinel values
In OMPI 1.8 and 1.8.1, we didn't allow gfortran to use the ignore-TKR style "mpi" Fortran module (which is written in Fortran). Instead, gfortran used the TKR style "mpi" module, which is written in C. In OMPI 1.8.2, we removed the gfortran restriction (for suitably modern gfortran -- i.e., >= 4.9). This allowed gfortran to use the ignore-TKR style "mpi" module, but exposed a bug where MPI Fortran sentinel values wouldn't be linked properly on OS X. The solution is to use ```-Wl,-flat_namespace``` (see the OS X ld(1) man page for details) when both building the libraries and in the wrapper compilers. Thanks to Github user yafshar for rasising the issue. Fixes #259.
Этот коммит содержится в:
родитель
a2c85c6d16
Коммит
6164dc4960
@ -13,7 +13,7 @@ dnl All rights reserved.
|
|||||||
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
||||||
dnl reserved.
|
dnl reserved.
|
||||||
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
||||||
dnl Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
|
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
|
||||||
dnl $COPYRIGHT$
|
dnl $COPYRIGHT$
|
||||||
dnl
|
dnl
|
||||||
dnl Additional copyrights may follow
|
dnl Additional copyrights may follow
|
||||||
@ -131,23 +131,26 @@ AC_DEFUN([OMPI_SETUP_FC],[
|
|||||||
[AC_FC_SRCEXT(f)
|
[AC_FC_SRCEXT(f)
|
||||||
AC_FC_SRCEXT(f90)])
|
AC_FC_SRCEXT(f90)])
|
||||||
|
|
||||||
# Per #1982, on OS X, we may need some esoteric linker flags in
|
# Per trac #1982, on OS X, we may need some esoteric linker flags
|
||||||
# the wrapper compilers. Assume that we need it for both F77 and
|
# in the wrapper compilers. However, per
|
||||||
# FC flags (note that in an upcoming update where there will only
|
# https://github.com/open-mpi/ompi/issues/259, we need to use
|
||||||
# be one Fortran compiler, anyway).
|
# -Wl,-flat_namespace when *building* the library (and
|
||||||
|
# -Wl,-commons,use_dylibs isn't quite sufficient).
|
||||||
AS_IF([test $ompi_fc_happy -eq 1],
|
AS_IF([test $ompi_fc_happy -eq 1],
|
||||||
[AC_MSG_CHECKING([to see if Fortran compilers need additional linker flags])
|
[AC_MSG_CHECKING([to see if Fortran compilers need additional linker flags])
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*apple-darwin*)
|
*apple-darwin*)
|
||||||
# Test whether -Wl,-commons,use_dylibs works; if it
|
# Test whether -Wl,-flat_namespace works; if it does,
|
||||||
# does, use it.
|
# both use it to build the libraries, and also put it
|
||||||
|
# in the wrapper compiler LDFLAGS.
|
||||||
LDFLAGS_save=$LDFLAGS
|
LDFLAGS_save=$LDFLAGS
|
||||||
LDFLAGS="$LDFLAGS -Wl,-commons,use_dylibs"
|
LDFLAGS="$LDFLAGS -Wl,-flat_namespace"
|
||||||
AC_LANG_PUSH([Fortran])
|
AC_LANG_PUSH([Fortran])
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
|
||||||
integer :: i
|
integer :: i
|
||||||
end program]])],
|
end program]])],
|
||||||
[OMPI_FORTRAN_WRAPPER_FLAGS="-Wl,-commons,use_dylibs"
|
[LDFLAGS_save=$LDFLAGS
|
||||||
|
OMPI_FORTRAN_WRAPPER_FLAGS="-Wl,-flat_namespace"
|
||||||
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$OMPI_FORTRAN_WRAPPER_FLAGS])],
|
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$OMPI_FORTRAN_WRAPPER_FLAGS])],
|
||||||
[OMPI_FORTRAN_WRAPPER_FLAGS=none])
|
[OMPI_FORTRAN_WRAPPER_FLAGS=none])
|
||||||
AC_LANG_POP([Fortran])
|
AC_LANG_POP([Fortran])
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user