From f4a47a5a8e4e3f2c902807d75e211f7f500f802b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 31 Dec 2019 07:17:01 -0800 Subject: [PATCH 1/2] fortran: remove useless CPPFLAGS assignment These -D's are for C compilation, not Fortran compilation. Remove this useless statement. Signed-off-by: Jeff Squyres --- ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am | 4 +--- ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 0c131e4f91..1819949fcd 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -19,8 +19,6 @@ include $(top_srcdir)/Makefile.ompi-rules # mpi" MPI bindings. if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS -AM_CPPFLAGS = -DOMPI_PROFILE_LAYER=0 -DOMPI_COMPILING_FORTRAN_WRAPPERS=1 - AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am index 5bd68ddea3..8f3157f819 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -13,10 +13,17 @@ # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # We must set these #defines and include paths so that the inner OMPI # MPI prototype header files do the Right Thing. AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) # Note that the mpi_f08-based bindings are optional -- they can only # be built if OMPI is also building the Fortran-based bindings. So we From ab398f4b9a340b54a88b83021b66911fe46d5862 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 31 Dec 2019 07:06:51 -0800 Subject: [PATCH 2/2] fortran: ensure not to use [AM_]CPPFLAGS Automake's Fortran compilation rules inexplicably use CPPFLAGS and AM_CPPFLAGS. Unfortunately, this can cause problems in some cases (e.g., picking up already-installed mpi.mod in a system-default include search path). So in relevant module-using Fortran compilation Makefile.am's, zero out CPPFLAGS and AM_CPPFLAGS. This has a side-effect of requiring that we compile the one .c file in the F08 library in a new, separate subdirectory (with its own Makefile.am that does _not_ have CPPFLAGS/AM_CPPFLAGS zeroed out). Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet --- config/ompi_config_files.m4 | 3 +- ompi/Makefile.am | 4 ++- .../fortran/mpiext-use-mpi-f08/Makefile.am | 11 ++++-- ompi/mpi/fortran/mpiext-use-mpi/Makefile.am | 11 ++++-- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 21 +++++++++--- ompi/mpi/fortran/use-mpi-f08/base/Makefile.am | 34 +++++++++++++++++++ .../use-mpi-f08/{ => base}/buffer_detach.c | 0 .../fortran/use-mpi-f08/bindings/Makefile.am | 11 ++++-- ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am | 11 ++++-- .../fortran/use-mpi-ignore-tkr/Makefile.am | 7 ++++ ompi/mpi/fortran/use-mpi-tkr/Makefile.am | 11 ++++-- 11 files changed, 107 insertions(+), 17 deletions(-) create mode 100644 ompi/mpi/fortran/use-mpi-f08/base/Makefile.am rename ompi/mpi/fortran/use-mpi-f08/{ => base}/buffer_detach.c (100%) diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 274b404d75..e0a968b3ac 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 Los Alamos National Security, LLC. All rights @@ -38,6 +38,7 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-removed-interfaces.h ompi/mpi/fortran/use-mpi-f08/Makefile + ompi/mpi/fortran/use-mpi-f08/base/Makefile ompi/mpi/fortran/use-mpi-f08/bindings/Makefile ompi/mpi/fortran/use-mpi-f08/mod/Makefile ompi/mpi/fortran/mpiext-use-mpi/Makefile diff --git a/ompi/Makefile.am b/ompi/Makefile.am index 5d1ce31ea8..dfaa42b0e7 100644 --- a/ompi/Makefile.am +++ b/ompi/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) 2008-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2010-2011 Sandia National Laboratories. All rights reserved. # Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights @@ -92,6 +92,7 @@ SUBDIRS = \ $(OMPI_MPIEXT_USEMPI_DIR) \ $(OMPI_FORTRAN_USEMPI_DIR) \ mpi/fortran/mpiext-use-mpi \ + mpi/fortran/use-mpi-f08/base \ mpi/fortran/use-mpi-f08/mod \ mpi/fortran/use-mpi-f08/bindings \ $(OMPI_MPIEXT_USEMPIF08_DIRS) \ @@ -124,6 +125,7 @@ DIST_SUBDIRS = \ mpi/fortran/use-mpi-ignore-tkr \ mpi/fortran/mpiext-use-mpi \ mpi/fortran/use-mpi-f08 \ + mpi/fortran/use-mpi-f08/base \ mpi/fortran/use-mpi-f08/mod \ mpi/fortran/use-mpi-f08/bindings \ mpi/fortran/mpiext-use-mpi-f08 \ diff --git a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am index 616982611a..23186eedb4 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -10,6 +10,13 @@ # $HEADER$ # +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # # Only do the stuff in this file if we're going to build # the mpi_f08 ext modules. @@ -23,7 +30,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) flibs = diff --git a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am index b8318ce93c..71bfad26d9 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -10,6 +10,13 @@ # $HEADER$ # +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # # Only do the stuff in this file if we're going to build # the mpi ext modules. @@ -22,7 +29,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-ignore-tkr \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) flibs = diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 734efdd83e..2ed9a01997 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile.am -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. @@ -23,6 +23,13 @@ include $(top_srcdir)/Makefile.ompi-rules +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This Makefile is only relevant if we're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -32,7 +39,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG)mod \ $(OMPI_FC_MODULE_FLAG)bindings \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod @@ -801,8 +808,7 @@ pmpi_api_files = \ lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \ $(mpi_api_files) \ $(pmpi_api_files) \ - mpi-f08.F90 \ - buffer_detach.c + mpi-f08.F90 # These are generated; do not ship them nodist_lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = @@ -818,12 +824,17 @@ endif # # Include the mpi_f08-based MPI extensions in libmpi_usempif08, too. # +# Also include the one .c file that we need in this library -- because +# we zero out CPPFLAGS and AM_CPPFLAGS in this Makefile.am, we have to +# compile that .c file in a separate directory / Makefile. +# lib@OMPI_LIBMPI_NAME@_usempif08_la_LIBADD = \ $(OMPI_MPIEXT_USEMPIF08_LIBS) \ $(top_builddir)/ompi/mpi/fortran/mpif-h/lib@OMPI_LIBMPI_NAME@_mpifh.la \ $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ - mod/libusempif08_internal_modules.la + mod/libusempif08_internal_modules.la \ + base/libusempif08_ccode.la lib@OMPI_LIBMPI_NAME@_usempif08_la_DEPENDENCIES = $(module_sentinel_files) lib@OMPI_LIBMPI_NAME@_usempif08_la_LDFLAGS = -version-info $(libmpi_usempif08_so_version) diff --git a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am new file mode 100644 index 0000000000..7e1bc3bc29 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am @@ -0,0 +1,34 @@ +# -*- makefile -*- +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +include $(top_srcdir)/Makefile.ompi-rules + +# This Makefile is only relevant if we're building the "use mpi_f08" +# MPI bindings. +if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS + +# This directory only exists so that we can separate C compilation +# from Fortran compilation. Specifically: note that Automake's +# Fortran-buidling rules uses CPPFLAGS and AM_CPPFLAGS. This can +# cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). So when compiling +# Fortran, we should zero out CPPFLAGS and AM_CPPFLAGS. + +# HOWEVER, we have one .c file in the use-mpi-f08 library. So we have +# to split it out to its own directory / Makefile.am where CPPFLAGS / +# AM_CPPFLAGS are *not* zeroed out. + +noinst_LTLIBRARIES = libusempif08_ccode.la + +libusempif08_ccode_la_SOURCES = \ + buffer_detach.c + +endif diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_detach.c b/ompi/mpi/fortran/use-mpi-f08/base/buffer_detach.c similarity index 100% rename from ompi/mpi/fortran/use-mpi-f08/buffer_detach.c rename to ompi/mpi/fortran/use-mpi-f08/base/buffer_detach.c diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am index 77f861a6ba..b00d08757c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. @@ -20,6 +20,13 @@ include $(top_srcdir)/Makefile.ompi-rules +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This Makefile is only relevant if we're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -29,7 +36,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ $(OMPI_FC_MODULE_FLAG)../mod \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index 44b9a96de8..ae85a4a7ea 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. @@ -20,6 +20,13 @@ include $(top_srcdir)/Makefile.ompi-rules +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This Makefile is only relevant if we're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -28,7 +35,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 1819949fcd..481cf80047 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -15,6 +15,13 @@ include $(top_srcdir)/Makefile.ompi-rules +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This Makefile is only relevant if we're building the ignore-TKR "use # mpi" MPI bindings. if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS diff --git a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am index 65c6fe2c0e..8ffd719dbb 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am @@ -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) 2006-2018 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2007 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2014-2016 Research Organization for Information Science @@ -32,6 +32,13 @@ include $(top_srcdir)/Makefile.ompi-rules # this directory -- instead, they compile # ompi/fortran/use-mpi-ignore-tkr. +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS ######################################################################## @@ -41,7 +48,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS # current directory) because it is generated. AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ - $(OMPI_FC_MODULE_FLAG). -I$(srcdir) -I. \ + $(OMPI_FC_MODULE_FLAG). -I$(top_srcdir) -I$(top_builddir) -I. \ -I$(top_builddir)/ompi/mpi/fortran/use-mpi-tkr $(FCFLAGS_f90) # Do different things if the top-level configure decided that we're