I’m compiling code from the SCHISM coastal model that I’ve modified to introduce some new functionality. When trying to compile it on macOS with GNU gfortran-14 (or 13) from Homebrew, I’m finding that no module interface foo.mod
files are being generated. They’re not in the source file directory, they’re not in the object output directory, they’re not in the working directory, and when -Jmoddir
is specified, they’re not in moddir/
either.
Here’s an example command line:
/opt/homebrew/bin/gfortran-14 -DMPIVERSION=2 -DSCHISM -DUSE_BMI -DUSE_HYDRO -DUSE_SCHISM -I/opt/homebrew/Cellar/open-mpi/5.0.3_1/include -I/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib -I/Users/phil/Code/noaa/BUILD/schism_2025-01-21/include -O2 -ffree-line-length-none -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -mmacosx-version-min=14.6 --preprocess -fallow-argument-mismatch -ffree-line-length-none -c /Users/phil/Code/noaa/schism_NWM_BMI/src/Core/schism_glbl.F90 -o CMakeFiles/core.dir/schism_glbl.F90.o
That source file contains module schism_glbl
, and the command runs successfully, generating the specified object file. But, no corresponding schism_glbl.mod
anywhere I look. This ultimately fails my builds, because CMake is expecting to see those resulting module files to use in compiling later objects.
I’m not able to find anything online about when gfortran might not emit a module file. I’ve checked the GNU Fortran manual, its wiki, this Discourse, the CMake Discourse, and Googled more broadly. Does anyone know why this is happening, and/or what one can do about it?