Community Modeling and Analysis System

CMAS Porting Guide

This page describes building different CMAS software components on unsupported environments. If you did not find a suitable build environment in the distributed software packages check this page for documentation on builds that were reported from within the community. Keep in mind that the CMAS Center has performed limited testing on these other builds and will not actively support them. We would however like feedback on problems with these different ports.

To share guidance on ports through this webpage, contact the CMAS Support Administrator.

Guidance is available for the following configurations:

MacOS X with xlf Fortran


Researchers at University of Wisconsin--Madison (Dr. Tracey Holloway, John Bachan, and Scott Spak) ported CMAQ version 4.3 and associated libraries to MacOS X using the xlf compiler, and they have provided detailed instructions for future users. CMAS tested and modified her scripts for CMAQ version 4.5. We are providing her instructions in the form of a modified CMAQ README for MacOS X along with a tar file of modified build scripts for each CMAQ component per Dr. Holloway's instructions. In addition to build scripts, the tar file contains revised source code for the CMAQ model builder (m3bld).


Use the following setting for compiling the I/O API version 3.0 on MacOS X running Darwin.

AR = ar
CC = gcc
FC = /opt/ibmcmp/xlf/8.1/bin/xlf
M4 = m4

FOPTFLAGS = -O3 -qstrict -qnosave -qfixed -bstatic


Craig Mattocks developed an install script for the netcdf library that can be downloaded from


For the IBM xlf compiler on MacOS X the default IBM compiler flags in the MCIP Makefile requires only basic modifications to generate a working MCIP executable. Use the following flags in the MCIP Makefile.

FC = /opt/ibmcmp/xlf/8.1/bin/xlf
FFLAGS = -qfree -O3 -qstrict -I$(NETCDF)/include
LIBS = -L$(IOAPI)/Darwin -lioapi -L$(NETCDF)/lib/Darwin -lnetcdf -lSystemStubs

We found that the addition of the SystemStubs library flag (-lSystemStubs) is required to compile all CMAQ programs using the xlf compiler on MacOS X.

Fedora Core 4 with IFORT 8.1


CMAS used the following compiler flags to build all of the CMAQ programs with IFORT 8.1 on several different Pentium PCs running Fedora Core 4.

FC = ifort
F_FLAGS = -extend_source 132 -cm -w95 -O2 -module ${MODLOC} -I.
C_FLAGS = -v -O2 -I.
LINK_FLAGS = -Bstatic


Set the BIN environment variable to Linux2_x86ifc and invoke the Makefile distributed with the IOAPI to build the necessary library.


From information on the netCDF other builds page we used the following settings to create a working netCDF library for this system configuration.

FC = ifort
FFLAGS = -g -O2 -mp -recursive
CC = gcc
CXX = g++
CFLAGS= -g -O2


FC = ifort
FFLAGS = -O3 -pc32 -FR -check all -I$(NETCDF)/include

64-bit Opteron processors, PGI (6.2-5) compiler, and SUSE Linux Enterprise Server 9 SP3

Prakash Doraiswamy and Winston Hao at the Atmospheric Sciences Research Center, State University of New York at Albany were able to compile netcdf (version 3.6.1), i/o api (version 3) and cmaq v4.6 successfully on their 64-bit cluster (Opteron processors), using a PGI (6.2-5) compiler.

For netcdf 3.6.1: We had to add the flags suggested on the PGI website for netcdf to compile successfully. The following worked for us:
setenv CFLAGS "-O2 -Msignextend -V"
setenv CPPFLAGS "-DNDEBUG -DpgiFortran"
setenv FFLAGS "-O2 -w -V"

For i/o api 3.0: If I remember correctly, following the instructions in the installation guide worked. I think we used Makeinclude.Linux2_x86pg_pgcc_nomp, and made some modifications to it, as shown below (some settings were commented out). Our settings were:

AR = ar
CC = pgcc
FC = pgf90
#M4 = m4
CPP = cpp
LINK = $(CC)

# MFLAGS = -fast -Mnosecond_underscore # -Mnoupcase

OMPFLAGS = # -mp
OMPLIBS = # -lmp
COPTFLAGS = -O2 -DNDEBUG -Msignextend
FOPTFLAGS = -O2 -V -Mnosecond_underscore
FSFLAGS = -Msave
LIBDIR = $(SRCDIR)/../lib
BINDIR = $(SRCDIR)/../bin

#PVMLIBS = -L$(PVM_ROOT)/lib/$(PVM_ARCH) -lpvm3
#M4DEFFILE = $(PVM_ROOT)/conf/$(PVM_ARCH).m4

Ubuntu with Gfortran

Barron Henderson at the UNC Deptartment of Environmental Sciences used the following compiler flags to build all of the CMAQ programs with Gnu Fortran on Linux PCs running Ubuntu.


FC = /usr/bin/gfortran
F_FLAGS = -ffixed-line-length-none -c -J ${MODLOC} -I.
C_FLAGS = -v -O2 -I.
LINK_FLAGS = -fno-automatic

Manually edit the CMAQ build scripts to replace -lnetcdf with "-lnetcdff -lnetcdf" and for the I/O API library directory use Linux2_x86gfortran (detailed below).


Copy Makeinclude.Linux2_x86g95 to Makeinclude.Linux2_x86gfortran. Make the following edits to the new Makeinclude file:

MFLAGS=-ffast-math -ffixed-line-length-none
FSFLAGS=-fno-automatic -ff2c
ARCHLIB=-lc -lgfortran -lg2c


From information on the netCDF Platform-Specific Notes page we used the following settings to create a working netCDF library for this system configuration.

FC = gfortran
CPPFLAGS = -Df2cFotran