From f055772c6b4dce0cb9032a7f63f99b99d63c4608 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Mon, 24 Jan 2022 11:18:10 -0500 Subject: [PATCH 1/2] Fix Fortran preprocessor issue with CPPFLAGS * Some C and Fortran compilers use different preprocessors. If one preprocessor accepts `-iquote` and the other does not then a compiler error will occur when Open MPI tries to use it. - Nvidia/PGI v22.1-0 is one such. The C compiler supports `-iquote` while the Fortran compiler does not. * Similar to PR #7265 we need to clear the `CPPFLAGS` and `AM_CPPFLAGS` Signed-off-by: Joshua Hursey (cherry picked from commit bbe57887bfbfd535945a3f5a1ac5af15b25303f9) --- ompi/mpiext/example/use-mpi-f08/Makefile.am | 9 +++++++++ ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ompi/mpiext/example/use-mpi-f08/Makefile.am b/ompi/mpiext/example/use-mpi-f08/Makefile.am index f495b4414d6..ef2ddd79d13 100644 --- a/ompi/mpiext/example/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/example/use-mpi-f08/Makefile.am @@ -2,6 +2,7 @@ # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2022 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -9,6 +10,14 @@ # $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 and +# https://github.com/open-mpi/ompi/issues/9716). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. diff --git a/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am b/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am index d06c0aa6837..075bd2fbe12 100644 --- a/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am @@ -6,6 +6,7 @@ # Copyright (c) 2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. +# Copyright (c) 2022 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -13,6 +14,14 @@ # $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 and +# https://github.com/open-mpi/ompi/issues/9716). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. From bfdebed8da5a7a3a3e8484facfb08409ddc92ad9 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sun, 8 Nov 2020 15:16:05 +0900 Subject: [PATCH 2/2] fortran: ensure not to use [AM_]CPPFLAGS Add missing bits from open-mpi/ompi@ab398f4b9a340b54a88b83021b66911fe46d5862 Signed-off-by: Gilles Gouaillardet (cherry picked from commit ca03269b2b0868da54d1fa22e583bd9180eb940b) --- ompi/mpi/fortran/use-mpi-f08/profile/Makefile.am | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/profile/Makefile.am index 4f0baa82680..bd11ded4657 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/profile/Makefile.am @@ -28,6 +28,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