Skip to content

Instantly share code, notes, and snippets.

@raphaeldussin
Created March 2, 2018 16:52
Show Gist options
  • Save raphaeldussin/f80c50ad1c95b2dd62f7f37e32ce494b to your computer and use it in GitHub Desktop.
Save raphaeldussin/f80c50ad1c95b2dd62f7f37e32ce494b to your computer and use it in GitHub Desktop.
Installing ESMF 7.0.2 + ESMPy on OSX High Sierra with macports
--- build_rules.mk.orig 2018-03-01 10:28:42.000000000 -0500
+++ build_rules.mk 2018-03-01 10:29:01.000000000 -0500
@@ -63,7 +63,7 @@
ESMF_CXXLINKLIBS += -lmpi_mpifh
else
ESMF_F90DEFAULT = mpif90
-ESMF_CXXLINKLIBS += -lmpi_f77
+ESMF_CXXLINKLIBS += $(shell mpif90 --showme:linking)
endif
ESMF_CXXCOMPILECPPFLAGS+= -DESMF_NO_SIGUSR2
ESMF_F90LINKLIBS += -lmpi_cxx
#!/bin/bash
# run this script as sudo
# 1. extract archive :
tar -xf esmf_7_0_2_src.tar
# 2. patch the file esmf/build_config/Darwin.gfortran.default/build_rules.mk
cp build_rules.mk.patch ./esmf/build_config/Darwin.gfortran.default/.
cd ./esmf/build_config/Darwin.gfortran.default/.
patch < build_rules.mk.patch
rm build_rules.mk.patch
cd -
# 3. Install
cd esmf
export ESMF_COMM=openmpi
export ESMF_NETCDF=split
export ESMF_NETCDF_INCLUDE=/opt/local/include
export ESMF_NETCDF_LIBPATH=/opt/local/lib
export ESMF_NETCDF_LIBS=$(nf-config --flibs)
export ESMF_DIR=$( pwd )
export ESMF_INSTALL_PREFIX=/opt/esm-soft/esmf/7.0.2 # or wherever you like
rm -rf ${ESMF_INSTALL_PREFIX}
mkdir -p ${ESMF_INSTALL_PREFIX}
make
make install
# this will compile the python wrapper
cd src/addon/ESMPy
echo /opt/local/bin/python setup.py build --ESMFMKFILE=${ESMF_INSTALL_PREFIX}/lib/libO/Darwin.gfortran.64.openmpi.default/esmf.mk install
/opt/local/bin/python setup.py build --ESMFMKFILE=${ESMF_INSTALL_PREFIX}/lib/libO/Darwin.gfortran.64.openmpi.default/esmf.mk install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment