Finished Compiling COAWST - MAC OSX Leopard 10.6.8

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
tarankalra
Posts: 5
Joined: Wed Dec 10, 2014 9:34 pm
Location: University of Maryland

Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#1 Unread post by tarankalra »

I recently installed COAWST setup on my local Mac pro ( OSX 10.6.8 ) using homebrew (open source software package management system for installing softwares on MAC similar to linux using command line). I believe that this post might help in installing ROMS/COAWST on Apple machines. It installs the setup with gfortran.

Steps to install

1. Install homebrew
---------------------------------------------------------------------------------------
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homeb ... er/install)"
---------------------------------------------------------------------------------------

All the next steps use homebrew to install the softwares required
to install ROMS/COAWST (subversion, GNUMAKE, Gfortran, Perl, Gcc, netcdf, hd5).

2. Install subversion
---------------------------------------------------------------------------------------
brew install subversion
---------------------------------------------------------------------------------------
Add the installation path to .bash_profile
export PATH=/opt/subversion/bin:$PATH

3. Do a SVN check out of the source code (ROMS/COAWST)
---------------------------------------------------------------------------------------
svn checkout --username usrname https://coawstmodel.sourcerepo.com/coawstmodel/COAWST .
---------------------------------------------------------------------------------------

4. Install gnu-make
---------------------------------------------------------------------------------------
brew install coreutils
---------------------------------------------------------------------------------------
Add to .bash_profile
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

5. Install gfortran, gcc
---------------------------------------------------------------------------------------
brew install gfortran
brew install gcc
---------------------------------------------------------------------------------------

6. Next is to install and compile fortran enabled netcdf and hdf5 files
---------------------------------------------------------------------------------------
brew tap homebrew/science
brew install netcdf --enable-fortran
brew install hdf5

Note* Change the ROMS/Compilers/Darwin-gfortran.mk file and add -lnetcdff flag
LIBS := -L$(NETCDF_LIBDIR) -lnetcdf -lnetcdff
Otherwise one would get an error discussed in detail on this post. viewtopic.php?f=31&t=3492
There is an alternative way to get around this error (also discussed in the same post) :
---------------------------------------------------------------------------------------
Add to .bash_profile
export NETCDF_INCDIR=/usr/local/Cellar/netcdf/4.3.2_1/include
export NETCDF_LIBDIR=/usr/local/Cellar/netcdf/4.3.2_1/lib
export HDF5_LIBDIR=/usr/local/Cellar/hdf5/1.8.14/lib

This is my first attempt to install the setup on a local machine so any inputs to the
page or missing information are much appreciated.

Thank you,
Taran

nowacki
Posts: 1
Joined: Mon Mar 11, 2013 9:01 pm
Location: U.S. Geological Survey, Woods Hole, MA

Re: Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#2 Unread post by nowacki »

A few things have changed since Taran's helpful post. You don't need to modify as many paths as in the past. These steps should result in a successful installation on OS X 10.10.5 (Yosemite) using COAWST SVN version 1102.


1. Install Homebrew

Code: Select all

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
1a. Install subversion if desired (already comes with OS X, so not strictly necessary

Code: Select all

brew install subversion
2. gfortran is now packaged as part of gcc, so install both using:

Code: Select all

brew install gcc
3. Install NetCDF with fortran support. You may need to tap homebrew/science. You may get a dependency warning. this should be OK.

Code: Select all

brew install netcdf --with-fortran
export NETCDF_INCDIR=/usr/local/include
export NETCDF_LIBDIR=/usr/local/lib
export NETCDF=/usr/local/opt/netcdf
export HDF5_LIBDIR=/usr/local/lib
The export lines should be added to your .bash_profile

4. Install MCT from the coawst distribution. Inside Lib/MCT, run;

Code: Select all

./configure
make
make install
export MCT_INCDIR=/usr/local/include
export MCT_LIBDIR=/usr/local/lib
The export lines should be added to your .bash_profile

5. Edit coawst.bash. You need to make the following changes:
change MY_ROOT_DIR to appropriate install location
change FORT to gfortran
change USE_MPIF90=on

6. In Compilers/Darwin-gfortran.mk, add the following lines at the end of the file, just before the endif on the last line. These are new files in the SWAN distribution that have long lines that need to be taken care of.

Code: Select all

$(SCRATCH_DIR)/SwanCompUnstruc.o:   FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanConvStopc.o:   FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInterpolateAc.o:   FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInterpolateOutput.o:   FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPropvelS.o:   FFLAGS += -ffree-form -ffree-line-length-none
7. Edit SWAN/Src/ocpmix.F and delete the "30.72" at the end of each line.

Go to your coawst directory and run ./coawst.bash

Everything should compile OK and you now have a working INLET_TEST testcase using COAWST.

fanshang
Posts: 3
Joined: Tue Oct 18, 2016 1:52 am
Location: Hohai University

Re: Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#3 Unread post by fanshang »

Hi,

I tried to install COAWST on the MAC OS Sierra 10.12 and I followed the above instructions step by step. However, I was stopped at the step to install the MCT. Before configure the MCT, I used home-brew to install mpich version 3.2_2, it is as following:
$ ll /usr/local/bin/mpif90
/usr/local/bin/mpif90 -> ../Cellar/mpich/3.2_2/bin/mpif90

Then I went to COAWST/
ran ./configure --> which looks fine and then I typed make, the errors show up as following:

~/Documents/My_Projects/SouthAtlanticBight/COAWST/Lib/MCT
$ make
make[1]: Entering directory `/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/COAWST/Lib/MCT/mpeu'
cc -c -DFORTRAN_MANGLING_UNKNOWN -DSYSDARWIN -DCPRGNU -O get_zeits.c
make[1]: *** No rule to make target `m_FcComms.o', needed by `libmpeu.a'. Stop.
make[1]: Leaving directory `/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/COAWST/Lib/MCT/mpeu'
make: *** [subdirs] Error 2


Any ideal to solve this problem?? Many thanks in advance.
Fan

jcwarner
Posts: 1200
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#4 Unread post by jcwarner »

to build MCT, you need to do a ./configure in the MCT root dir. This will create a Makefile.conf, you should look in that to see if the settings are correct. Then do a make.
-j

fanshang
Posts: 3
Joined: Tue Oct 18, 2016 1:52 am
Location: Hohai University

Re: Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#5 Unread post by fanshang »

Thanks, Dr.Warner.

Looks like the configure didn't go through at first. I had the errors like the following:
checking how to get the version output from gfortran... configure: WARNING: compilation failed

When I did the above configure, I had the fortran linked to:
/usr/local/bin/gfortran -> powerpc-apple-darwin8-gfortran-4.2,

and after then I changed it into another version of the gfortran_4.2, then did the configure again, it went like the following:
checking if Fortran 90 compiler performs preprocessing... yes
checking if C preprocessor can work with Fortran compiler... sed: conftest.f90: No such file or directory
no
Hostname=Xis-MacBook-Pro.local
Machine=x86_64
OS=Darwin
Fortran Compiler is GNU

Output Variables: {CC=cc} {ALLCFLAGS=-DFORTRAN_GNUF2C -DSYSDARWIN -DCPRGNU -O} {FPP=cpp} {FPPFLAGS=-P -C -N -traditional} {FC=mpif90} {F90=gfortran} {FCFLAGS=} {F90FLAGS=} {MACHDEFS=-DSYSDARWIN -DCPRGNU} {OPT=} {REAL8=} {BIT64=} {ENDIAN=} {MPIF90=mpif90} {MPILIBS=} {MPIHEADER=} {INCLUDEFLAG=-I} {INCLUDEPATH=} {AR=ar cq} {BABELROOT=} {COMPILER_ROOT=} {PYTHON=} {PYTHONOPTS=} {FORT_SIZE=} {prefix=NONE}

configure: creating ./config.status
config.status: creating Makefile.conf
Please check the Makefile.conf
Have a nice day!



It looked like the Fortran 90 works, so I did the make. It went much further this time, but I got a lot of warnings. In the end, it ended like the following:

rm -f libmct.a
ar cq libmct.a m_MCTWorld.o m_AttrVect.o m_GlobalMap.o m_GlobalSegMap.o m_GlobalSegMapComms.o m_Accumulator.o m_SparseMatrix.o m_Navigator.o m_AttrVectComms.o m_AttrVectReduce.o m_AccumulatorComms.o m_GeneralGrid.o m_GeneralGridComms.o m_SpatialIntegral.o m_SpatialIntegralV.o m_MatAttrVectMul.o m_Merge.o m_GlobalToLocal.o m_ExchangeMaps.o m_ConvertMaps.o m_SparseMatrixDecomp.o m_SparseMatrixToMaps.o m_SparseMatrixComms.o m_SparseMatrixPlus.o m_Router.o m_Rearranger.o m_Transfer.o
make[1]: Leaving directory `/Users/fan/Documents/My_Projects/COAWST/Lib/MCT/mct'



Does that mean it has been successfully built? How should I check for its feasibility?

Many Thanks,
Fan

fanshang
Posts: 3
Joined: Tue Oct 18, 2016 1:52 am
Location: Hohai University

Re: Finished Compiling COAWST - MAC OSX Leopard 10.6.8

#6 Unread post by fanshang »

Hi,

I was supposed to get the MCT built up, however, when I built up COAWST, I get it go through for a while and then warnings and errors occurred as following. I am not sure if it is due to a MAC version or a netcdf errors. Anyone has the same experience can give me some advice?

Many Thanks,
CeeCee


ld: warning: ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/esmf_roms.o) was built for newer OSX version (10.12) than being linked (10.4)object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/get_numswan_grids.o) was built for newer OSX version (10.12) than being linked (10.4)

ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/get_sparse_matrix.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/master.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/mct_coupler_params.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/mct_coupler_utils.o) was built for newer OSX version (10.12) than being linked (10.4)ld: warning:
object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/mod_coupler_iounits.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/mod_coupler_kinds.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/ocean_control.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/ocean_coupler.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/propagator.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/read_coawst_par.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/read_model_inputs.o) was built for newer OSX version (10.12) than being linked (10.4)object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/roms_export.o) was built for newer OSX version (10.12) than being linked (10.4)

ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/roms_import.o) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_parallel.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_param.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_scalars.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(close_io.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(timers.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(wrt_rst.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_iounits.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_ncparam.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_netcdf.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libMODS.a(mod_stepping.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(nf_fwrite2d.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(nf_fwrite3d.o)) was built for newer OSX version (10.12) than being linked (10.4)
ld: warning: object file (/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/Build/libUTIL.a(get_date.o)) was built for newer OSX version (10.12) than being linked (10.4)
Undefined symbols for architecture i386:
"___netcdf__nf90_get_att_text", referenced from:
___mod_netcdf__netcdf_put_fvar_4d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_put_svar_0d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_get_var_1d_fourbyteint", referenced from:
___mod_netcdf__netcdf_get_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_inq_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fvar_0d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_get_var_1d_text", referenced from:
___mod_netcdf__netcdf_inq_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fatt in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_satt in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fvar_2d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_lvar_0d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_lvar_1d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
...
"___netcdf__nf90_get_var_2d_eightbytereal", referenced from:
___mod_netcdf__netcdf_put_fvar_2d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_put_ivar_0d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_put_lvar_0d in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_get_var_eightbytereal", referenced from:
___mod_netcdf__netcdf_enddef in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_inq_var in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_inq_attname", referenced from:
___mod_netcdf__netcdf_inq_varid in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_close in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_create in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_enddef in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_open in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
...
"___netcdf__nf90_inq_varid", referenced from:
___mod_netcdf__netcdf_get_fvar_4d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_sync in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_inquire_dimension", referenced from:
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_inq_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fatt in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_var in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_inquire_variable", referenced from:
___mod_netcdf__netcdf_get_fvar_3d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_put_fvar_3d in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_put_var_1d_eightbytereal", referenced from:
___mod_netcdf__netcdf_inq_varid in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_close in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_create in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_enddef in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_open in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
...
"___netcdf__nf90_put_var_1d_text", referenced from:
___mod_netcdf__netcdf_close in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fvar_1d in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_put_var_4d_eightbytereal", referenced from:
___mod_netcdf__netcdf_get_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_inq_var in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fatt in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_satt in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fvar_0d in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_fvar_1d in libMODS.a(mod_netcdf.o)
"___netcdf__nf90_redef", referenced from:
___mod_netcdf__netcdf_inq_varid in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_close in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_create in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_enddef in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_open in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_get_dim in libMODS.a(mod_netcdf.o)
___mod_netcdf__netcdf_check_dim in libMODS.a(mod_netcdf.o)
...
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [/Users/xifeng/Documents/My_Projects/SouthAtlanticBight/Tcodes/coawstS] Error 1

Post Reply