The OASIS Coupler Forum

  HOME

MacOS mpi header conflicts

Up to Installation and compilation

Posted by Anonymous at August 1 2025

Hello OASIS community,

I'm encountering a compilation issue with the PSMILE library on macOS (macOS 23.6.0, Intel MacBook Pro)

Environment:
- macOS 23.6.0 (Darwin 23.6.0)
- Intel MacBook Pro (Quad-Core Intel Core i5)
- Open-MPI 5.0.8 (installed via Homebrew)
- Gnu Fortran 10
- OASIS3-MCT latest version from GitHub

**Issue:**
The PSMILE library compilation fails with MPI header conflicts during the build process. Specifically, I'm getting these errors:

Error: Unexpected data declaration statement in INTERFACE block at (1)
mpif-sizeof.h:2642:38:
Error: Parameter 'real64' at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpif-sizeof.h:2641:36:
Error: Unexpected USE statement in INTERFACE block at (1)
mpif-sizeof.h:2640:11:

What works so far:
- MCT library compiles successfully
- MPEU library compiles successfully  
- SCRIP library compiles successfully
- Basic MPI programs work fine
- OASIS examples work with available libraries

What fails:
- PSMILE library compilation (specifically modules that use MPI interfaces)
- Full OASIS build due to PSMILE dependency

Attempted solutions:
1. Used `-DOMPI_SKIP_MPICXX=1` flag to prevent C++ MPI bindings
2. Updated environment variables for Open-MPI paths
3. Added `-fallow-argument-mismatch` compiler flag
4. Tried different MPI configurations

Question:
Is this a known compatibility issue between macOS and the PSMILE library's MPI interface design? Are there any recommended workarounds or configuration changes for macOS users?


Any guidance would be greatly appreciated!

Posted by Anonymous at August 25 2025

Hello,
Sorry for the delay due to summer holidays. It has been a while I did not compile oasis on my mac. At the time I was using the header makefille oasis3-mct/util/make_dir/make.gfortran10_openmpi4.0.5_mac , which should be close to what you need. Did you start from this header makefile? Let me know. I will try on my mac, when I git some time (the back-to-work period is not smooth :-( )
  Regards,
 Sophie

Posted by Anonymous at August 26 2025

Hi, I copy here a reply from O Marti sent to the list:
Hello,
On the Mac I compile with Fortran and mpi install by Homebrew. Apple clang for the C compiler. I join my makefile.
# -*- mode:make
#
# Include file for OASIS3 Makefile for a Mac Os system using
# Gnu 10 compilers and OpenMPI 4.0.5 (from Homebrew)
#
###############################################################################
#
# CHAN  : communication technique used in OASIS3 (MPI1/MPI2)
CHAN            = MPI1
#
# Paths for libraries, object files and binaries
#
# COUPLE        : path for oasis3-mct main directory
COUPLE          = $(OASIS3_ROOT)
#
# ARCHDIR       : directory created when compiling
ARCHDIR         = $(COUPLE)/INSTALL
#
# MPI command (for pyoasis scripts)
MPIRUN      = mpirun --oversubscribe
#
# NETCDF library
NETCDF_INCLUDE = /opt/homebrew/include
NETCDF_LIBRARY = -L/opt/homebrew/lib -lnetcdff -lnetcdf
#
# Make command
MAKE        = make
# Compilers
F90         = mpif90
F           = $(F90)
f90         = $(F90)
f           = $(F90)
CC          = mpicc
# Linker (needed for shared libraries)
LD          = $(F90)
# Static libraries compilation options
STATOPT     =
# Shared libraries options
DYNOPT      = -fPIC -Wl,-commons,use_dylibs
LDDYNOPT    = -shared -L/usr/local/opt/libevent/lib -lm
# Static archiver
AR          = ar
ARFLAGS     = -ruv
#
# CPP keys and compiler options
#
CPPDEF    = -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY
#
FCBASEFLAGS  = -O2 -I. -ffree-line-length-0 -fallow-argument-mismatch -mcmodel=small
#FCBASEFLAGS  = -g -ffree-line-length-0 -fallow-argument-mismatch -fcheck=bounds  -mcmodel=medium -fallow-argument-mismatch
CCBASEFLAGS  = -O2
#
# INC_DIR : includes all *mod for each library
INC_DIR = -I$(ARCHDIR)/include
#
F90FLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
f90FLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
FFLAGS   = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
fFLAGS   = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
CCFLAGS  = $(CCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE)
LDFLAGS  = $(FCBASEFLAGS)
FLIBS    = $(NETCDF_LIBRARY)
F2C_LDFLAGS = -lmpi_mpifh -lgfortran
#
#############################################################################
Reply to this