From 5afcf0aae679050b16636f668259da986cc557c5 Mon Sep 17 00:00:00 2001 From: "James V. Geiger" Date: Mon, 24 Oct 2022 18:10:12 +0000 Subject: [PATCH] Address errors raised by GNU compilers The GNU Fortran compiler raised errors when compiling source code that included mpif.h (needed when compiling with gfortran while using the Intel MPI library) or used the HDF-EOS2 library. The workaround is to add `-fallow-argument-mismatch` to the gfortran compiler flags. Note: On some systems, this compiler option is already added by the mpif90 wrapper script. --- ldt/make/Makefile | 11 +++++++++++ lis/make/Makefile | 21 +++++++++++++++++++++ lvt/make/Makefile | 8 ++++++++ 3 files changed, 40 insertions(+) diff --git a/ldt/make/Makefile b/ldt/make/Makefile index 6b9921c85..49639f87a 100644 --- a/ldt/make/Makefile +++ b/ldt/make/Makefile @@ -124,6 +124,17 @@ version.F90: @echo "Building version file $@" sh build_version.sh +ifeq ($(LIS_ARCH),linux_gfortran) +# For MPI +LDT_historyMod.o: LDT_historyMod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +# For HDF-EOS2 +readGLASSlaiObs.o: readGLASSlaiObs.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +readNASA_AMSREsmObs.o: readNASA_AMSREsmObs.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +endif + .PHONY: help help: @echo "" diff --git a/lis/make/Makefile b/lis/make/Makefile index 315b1c43c..fd639233e 100644 --- a/lis/make/Makefile +++ b/lis/make/Makefile @@ -163,6 +163,27 @@ soil_htc_jls_mod.o: soil_htc_jls_mod.F90 $(FC) $(FFLAGS) -O0 $(HEADER_DIRS) $< endif +ifeq ($(LIS_ARCH),linux_gfortran) +# For MPI +LIS_historyMod.o: LIS_historyMod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +LIS_DAobservationsMod.o: LIS_DAobservationsMod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +USAF_bratsethMod.o: USAF_bratsethMod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +gmaopert_Mod.o: gmaopert_Mod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +HYMAP2_routingMod.o: HYMAP2_routingMod.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +read_SMOSNRTNNL2sm.o: read_SMOSNRTNNL2sm.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +HYMAP2_model.o: HYMAP2_model.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +# For HDF-EOS2 +read_GLASSlai.o: read_GLASSlai.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +endif + .PHONY: help help: @echo "" diff --git a/lvt/make/Makefile b/lvt/make/Makefile index f9383a4a6..19c6eefae 100644 --- a/lvt/make/Makefile +++ b/lvt/make/Makefile @@ -124,6 +124,14 @@ version.F90: @echo "Building version file $@" sh build_version.sh +ifeq ($(LIS_ARCH),linux_gfortran) +# For HDF-EOS2 +readGLASSlaiObs.o: readGLASSlaiObs.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +readNASA_AMSREsmObs.o: readNASA_AMSREsmObs.F90 + $(FC) $(FFLAGS) -fallow-argument-mismatch $(HEADER_DIRS) $< +endif + .PHONY: help help: @echo ""