From 2121b2e5feb2f7d215e30f1b87730ce0f4093892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= Date: Fri, 8 Jul 2016 14:09:17 +0200 Subject: [PATCH] Fix actual reason for linker problems The actual reason for the linker problems was that the Fortran libraries where listed before the object files, by modifying the _LINK automake variables. The proper way to do is of course to add the necessary libraries after the object files by appending them to the _LDADD variables. As the MPI module was not responsible for the linker problems it is now used by default, unless explicitly switched off with --disable-mpi-module Also, the C test programs that had these linker errors where previously not compiled in the OpenMP case, for no obvious reason. Now they are also included there. --- Makefile.am | 27 +++++++-------------------- configure.ac | 13 ++++++------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5570529b..e7e92806 100644 --- a/Makefile.am +++ b/Makefile.am @@ -219,14 +219,12 @@ noinst_PROGRAMS = \ elpa2_test_real_api@SUFFIX@ \ elpa2_test_complex_api@SUFFIX@ \ elpa1_real_toeplitz@SUFFIX@ \ - elpa1_test_real_with_c@SUFFIX@ -if !WITH_OPENMP -noinst_PROGRAMS += \ + elpa1_test_real_with_c@SUFFIX@ \ elpa1_test_real_c_version@SUFFIX@ \ elpa1_test_complex_c_version@SUFFIX@ \ elpa2_test_real_c_version@SUFFIX@ \ elpa2_test_complex_c_version@SUFFIX@ -endif + build_lib = libelpa@SUFFIX@.la libelpatest@SUFFIX@.la @@ -250,31 +248,25 @@ libelpatest@SUFFIX@_la_SOURCES += \ test/shared/redirect.F90 endif -if !WITH_OPENMP elpa1_test_real_c_version@SUFFIX@_SOURCES = test/C/elpa1_test_real_c_version.c -elpa1_test_real_c_version@SUFFIX@_LDADD = $(build_lib) +elpa1_test_real_c_version@SUFFIX@_LDADD = $(build_lib) $(FCLIBS) elpa1_test_real_c_version@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules -elpa1_test_real_c_version@SUFFIX@_LINK = $(LINK) $(FCLIBS) EXTRA_elpa1_test_real_c_version@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90 elpa1_test_complex_c_version@SUFFIX@_SOURCES = test/C/elpa1_test_complex_c_version.c -elpa1_test_complex_c_version@SUFFIX@_LDADD = $(build_lib) +elpa1_test_complex_c_version@SUFFIX@_LDADD = $(build_lib) $(FCLIBS) elpa1_test_complex_c_version@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules -elpa1_test_complex_c_version@SUFFIX@_LINK = $(LINK) $(FCLIBS) EXTRA_elpa1_test_complex_c_version@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90 elpa2_test_real_c_version@SUFFIX@_SOURCES = test/C/elpa2_test_real_c_version.c -elpa2_test_real_c_version@SUFFIX@_LDADD = $(build_lib) +elpa2_test_real_c_version@SUFFIX@_LDADD = $(build_lib) $(FCLIBS) elpa2_test_real_c_version@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules -elpa2_test_real_c_version@SUFFIX@_LINK = $(LINK) $(FCLIBS) EXTRA_elpa2_test_real_c_version@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90 elpa2_test_complex_c_version@SUFFIX@_SOURCES = test/C/elpa2_test_complex_c_version.c -elpa2_test_complex_c_version@SUFFIX@_LDADD = $(build_lib) +elpa2_test_complex_c_version@SUFFIX@_LDADD = $(build_lib) $(FCLIBS) elpa2_test_complex_c_version@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules -elpa2_test_complex_c_version@SUFFIX@_LINK = $(LINK) $(FCLIBS) EXTRA_elpa2_test_complex_c_version@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90 -endif elpa1_test_real@SUFFIX@_SOURCES = test/Fortran/test_real.F90 elpa1_test_real@SUFFIX@_LDADD = $(build_lib) @@ -349,16 +341,11 @@ check_SCRIPTS = \ elpa2_test_real_api@SUFFIX@.sh \ elpa2_test_complex_api@SUFFIX@.sh \ elpa1_real_toeplitz@SUFFIX@.sh \ - elpa2_print_kernels@SUFFIX@ - - -if !WITH_OPENMP -check_SCRIPTS += \ + elpa2_print_kernels@SUFFIX@ \ elpa1_test_real_c_version@SUFFIX@.sh \ elpa1_test_complex_c_version@SUFFIX@.sh \ elpa2_test_real_c_version@SUFFIX@.sh \ elpa2_test_complex_c_version@SUFFIX@.sh -endif # test scripts diff --git a/configure.ac b/configure.ac index 6766fd73..5e3de95e 100644 --- a/configure.ac +++ b/configure.ac @@ -609,13 +609,12 @@ fi dnl Test possibility of 'use mpi', if requested if test x"${with_mpi}" = x"yes" ; then - AC_ARG_ENABLE([use-mpi], - AS_HELP_STRING([--enable-use-mpi], - [Use Fortran MPI module (otherwise 'include "mpif.h' is used)]), + AC_ARG_ENABLE([mpi-module], + AS_HELP_STRING([--disable-mpi-module], + [Do not use the Fortran MPI module, get interfaces by 'include "mpif.h')]), [], - [enable_use_mpi=no]) - AC_MSG_RESULT([${enable_use_mpi}]) - if test x"${enable_use_mpi}" = x"yes" ; then + [enable_mpi_module=yes]) + if test x"${enable_mpi_module}" = x"yes" ; then AC_MSG_CHECKING(whether Fortran mpi module can be used) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ program test_mpi_module @@ -631,7 +630,7 @@ if test x"${with_mpi}" = x"yes" ; then if test x"${can_use_fortran_mpi_module}" = x"yes" ; then AC_DEFINE([HAVE_MPI_MODULE],[1],[can use the Fortran mpi module]) else - AC_MSG_ERROR([Could not compile a Fortran program with an 'use mpi' statement]) + AC_MSG_ERROR([Could not compile a Fortran program with an 'use mpi' statement. You can try again with --disable-mpi-module]) fi fi fi -- GitLab