Tips for compiling QuaLiKiz from source on macOS
A manual for compiling QuaLiKiz from source on macOS.
Install the following:
- Install Apple Xcode command line developer tools with
xcode-select --install
in Terminal. - Install MacPorts and type
port install
the following ports [update versions if required in the future]:- gcc12,
- openmpi,
- netcdf-fortran.
- Download and compile the latest version of make [macOS comes with 3.81 which is insufficient] or use MacPorts to update it.
Then in the main QuaLiKiz folder (assuming you already cloned the repo somewhere, cd
there in Terminal, did git submodule init
and git submodule update
) create a file called usercfg.make containing the following:
ifeq ($(TUBS_CONFIG_PHASE),1)
TOOLCHAIN=gcc
BUILD=debug
else
ifeq ($(TOOLCHAIN), gcc)
FC=mpif90-openmpi-mp
AR=ar rcu
QLK_EXTRA_FFLAGS=
endif
ifeq ($(TOOLCHAIN), intel)
FC=mpiifort
endif
endif
QLK_HAVE_NAG=0
VERBOSE=1
LINK=$(FC)
Then modify the following lines in gcc_common.make in QuaLiKiz/tubs/variants/
LNKGRPBEG ?= -Wl,-\(
LNKGRPEND ?= -Wl,-\)
to
LNKGRPBEG ?= -W
LNKGRPEND ?= -W
In Terminal cd
to the main QuaLiKiz folder and type make TOOLCHAIN=gcc
(although TOOLCHAIN=gcc is optional as it should be the default already as specified in usercfg.make).
Assuming the compilation ends without errors QuaLiKiz is now compiled and ready for use on macOS (check if the QuaLiKiz executable appeared in QuaLiKiz/bin/). Hurray!