Commit c9892773 authored by Hendryk Bockelmann's avatar Hendryk Bockelmann
Browse files

add patch from Sergey Kosukhin to make sure that we do not have unresolved MPI symbols in libsct.so

parent 261681fa
......@@ -12,12 +12,28 @@ verlte $libtool_version 2.4.2 && {
# fix m4/libtool.m4 for nagfor sharedflag
# see https://trac.mpich.org/projects/mpich/ticket/1870 for details
patch --forward --no-backup-if-mismatch -p0 -s -l < maint/libtool.m4.patch
}
# rebuild configure
autoconf -f || exit $?
# Fix the problem when creating shared library with libtool and using MPI
# compiler wrapper. When LT_INIT is called before AX_PROG_FC_MPI in the
# configure.ac, the generated ./libtool doesn't know about the MPI
# compiler wrapper, which we do need since the logic of the script
# depends on the name of the compiler executable name (e.g. nagfor).
# But we also want to be able to link shared libraries using MPIFC.
# AX_PROG_FC_MPI sets FC=$MPIFC but ./libtool keeps using the hardcoded
# command that uses the actual compiler when creating a shared library.
# This patch instructs ./libtool to check whether $FC is set. If $FC
# is set ./libtool will use it for linking, and will act as usual otherwise.
# See also https://lists.gnu.org/archive/html/libtool/2012-05/msg00002.html
patch --forward --no-backup-if-mismatch -p0 -s -l < maint/libtool.m4.hardcoded.patch
# Reset libtool.m4 timestamps to avoid confusing make
touch -r m4/ltversion.m4 m4/libtool.m4
}
# rebuild configure
autoconf -f || exit $?
# Reset libtool.m4 timestamps to avoid confusing make
touch -r m4/ltversion.m4 m4/libtool.m4
# Libtool duplicates some of the command line flags (e.g. -fopenmp)
# when calling the actual compiler. nagfor considers this as an error.
patch --forward --no-backup-if-mismatch -p0 -s -l < maint/ltmain.sh.patch
......@@ -19,6 +19,8 @@ AM_INIT_AUTOMAKE([1.14 silent-rules no-dependencies])
AM_EXTRA_RECURSIVE_TARGETS([doc])
AC_CONFIG_SRCDIR([src/sct_reporter.c])
dnl LT_INIT must be called before AX_PROG_FC_MPI, otherwise
dnl it won't find out how to work with the underlying compiler.
LT_INIT([pic-only])
#
......
......@@ -16,8 +16,7 @@
#
# MPI-WANTED-TEST is used to test whether MPI is actually wanted by the
# user. If MPI-WANTED_TEST is omitted or if it succeeds, the macro will
# try to find out how to use MPI, if it fails, the macro will call
# AC_PROG_CC to find a standard C compiler instead.
# try to find out how to use MPI.
#
# When MPI is found, ACTION-IF-FOUND will be executed, if MPI is not found
# (or MPI-WANTED-TEST fails) ACTION-IF-NOT-FOUND is executed. If
......@@ -80,6 +79,7 @@ AC_PREREQ(2.50)
# Check for compiler
# Needs to be split off into an extra macro to ensure right expansion
# order.
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_AX_PROG_FC_MPI],[_AX_PROG_FC_MPI([$1])])
AS_IF([test x"$_ax_prog_fc_mpi_mpi_wanted" = xno],
......@@ -161,8 +161,11 @@ AC_DEFUN_ONCE([_AX_PROG_FC_MPI], [
AC_MSG_WARN([using FC=$FC as MPIFC compiler.])
MPIFC="$FC"
elif test -n "$FC" && test -n "$MPIFC"; then
AC_MSG_WARN([overwriting FC=$MPIFC.])
FC="$MPIFC"
dnl extract found options from FC if overriden by MPIFC
fc_opts="$FC "
fc_opts=${fc_opts#* }
AC_MSG_WARN([overwriting FC='$MPIFC $fc_opts'. was FC='$FC' ; MPIFC='$MPIFC'])
FC="$MPIFC $fc_opts"
fi
fi
......
--- m4/libtool.m4 2018-07-19 16:29:39.928156909 +0200
+++ m4/libtool.m4.hardcoded.patched 2018-07-19 16:26:58.730540710 +0200
@@ -6048,6 +6048,9 @@
esac
fi
fi
+ m4_ifval([$1],
+ [_LT_TAGVAR(archive_cmds, $1)=`AS_ECHO(["$_LT_TAGVAR(archive_cmds, $1)"]) | sed 's%\(\\\\\)\?\$CC%\\${FC:-\1$CC}%g'`
+ _LT_TAGVAR(archive_expsym_cmds, $1)=`AS_ECHO(["$_LT_TAGVAR(archive_expsym_cmds, $1)"]) | sed 's%\(\\\\\)\?\$CC%\\${FC:-\1$CC}%g'`])
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
......@@ -4,7 +4,7 @@ AM_FCFLAGS = $(FC_MODINC).. $(FCFLAGS_f90) $(FCDEFS)
lib_LTLIBRARIES = libsct.la
libsct_la_LIBADD = $(LTLIBPAPI) $(LTLIBHDF5)
libsct_la_LDFLAGS = $(OPENMP_FC_C_LT_FLAGS) -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
libsct_la_LDFLAGS = -Wl,-no-undefined $(OPENMP_FC_C_LT_FLAGS) -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
header = $(srcdir)/sct_config.h \
$(srcdir)/sct_mach.h \
$(srcdir)/sct_collector.h \
......
......@@ -9,4 +9,4 @@ test_serial
test_omp
test_mpi
test_hybrid
test_hdf5_fortran
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment