Installing ROMS on Mac El Captain

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
ssorou1
Posts: 10
Joined: Mon Feb 23, 2015 4:29 pm
Location: Louisiana State University

Installing ROMS on Mac El Captain

#1 Unread post by ssorou1 »

Hi,

I am trying to install ROMS on Mac OS X El Captain. I am using Macbook late 2009 (64 bit). I consulted the tutorial on installing ROMS on OS X Snow Leopard (https://www.myroms.org/wiki/ROMS_Mac_Snow_Leopard).

Xcode 7.3 is installed successfully.
MacPorts-2.3.4-10.11-ElCapitan is installed successfully.
gcc43 is installed successfully and the recommendation in the tutorial was applied.
GNU make 3.81 is installed successfully.
Perl exists.
Set up of build environment is done as stated in tutorial.

I get configure error in either MPI, HDF5, or NETCDF installation. Reported error is similar. The case of HDF5 installation for instance:

./configure --prefix=/opt/gfortransoft/serial/hdf5-1.8.4-patch1 --enable-fortran --enable-static-exec --disable-shared

Error message:
checking for gcc... gcc43
checking for C compiler default output file name...
configure: error: in `/Users/soroush/source_builds/hdf5-1.8.4-patch1':
configure: error: C compiler cannot create executables
See `config.log' for more details.

As for netcdf, I tried both netcdf-3.6.3 and netcdf-fortran-4.4.3 and did not succeed.

Your help is very much appreciated.

Thankfully,

jkasper

Re: Installing ROMS on Mac El Captain

#2 Unread post by jkasper »

It has been a while since I did this and I am not in front of my mac desktop at the moment where my readme is stored. But as I recall, it saves a lot of time if you install gcc, etc. using macports.
First download all of the necessary ports including

gcc45:
>sudo svn checkout https://svn.macports.org/repository/mac ... lang/gcc45

gnumake (this is likely installed in /usr/bin already, use command "which make" to find out)
perl (also most likely installed)
python (most likely installed)

Netcdf:
>sudo svn checkout https://svn.macports.org/repository/mac ... nce/netcdf

Netcdf-fortran:
>sudo svn checkout https://svn.macports.org/repository/mac ... df-fortran

Then install them
install gcc45:
>sudo port install gcc45

install netcdf (this installs hdf5 as well)
>sudo port -v install netcdf +netcdf4

install netcdf-fortran
>sudo port -v install netcdf-fortran +gcc45

configure environment:
> cd /opt/local/bin
> sudo ln -s gcc-mp-4.5 gcc45
> sudo ln -s g++-mp-4.5 g++45
> sudo ln -s gfortran-mp-4.5 gfortran

This is from memory so if I find any mistakes in what I've said here after I check my notes tomorrow I will update this post.
Sincerely,
Jeremy

ssorou1
Posts: 10
Joined: Mon Feb 23, 2015 4:29 pm
Location: Louisiana State University

Re: Installing ROMS on Mac El Captain

#3 Unread post by ssorou1 »

Jeremy,

Thank you very much for your thorough response. I tried your solution, which worked out. However, I got into an error while compiling ROMS for Upwelling case, which will be addressed.

The command used to configure netcdf-3.6.3 was as follows (after applying your adjustments and following procedure in https://www.myroms.org/wiki/ROMS_Mac_Snow_Leopard):
./configure --prefix=/Users/soroush/source_builds/netcdf3 --disable-shared --disable-cxx

It produced the following report, showing successful installation, I suppose:
.
.
.
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating fortran/nfconfig1.inc
config.status: fortran/nfconfig1.inc is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

I also tried the netcdf-fortran-4.4.3 version with the following command:
./configure --prefix=/Users/soroush/source_builds/netcdf4_f --disable-shared --disable-cxx

It was also installed successfully. Same lines were reported back as the netcdf-3.6.3 case. Only a warming was added to the lines as stated above:
configure: WARNING: unrecognized options: --disable-cxx

One strange thing I observed was that although I gave a prefix path for installation, no such directories are made. Rather, the include and lib folders of nercdf are found in:
/opt/local/include/
/opt/local/lib

Anyways, I gave those paths in build.bash file for NETCDF_INCDIR and NETCDF_LIBDIR, i.e.:
else
export NETCDF_INCDIR=/opt/local/include
export NETCDF_LIBDIR=/opt/local/lib
fi

However, when I try to compile ROMS, after writing a lot of stuff on screen and towards the end, I get this error:

"___netcdf_MOD_nf90_strerror", referenced from:
_close_out_ in libUTIL.a(close_io.o)
"___netcdf_MOD_nf90_sync", referenced from:
___mod_netcdf_MOD_netcdf_sync in libMODS.a(mod_netcdf.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [/Users/soroush/ROMS/projects/upwelling/oceanS] Error 1

I would appreciate if you share your thoughts how to solve this error.

One other point that looks strange to me is that when I type ncdump, I see the following response:

ncdump [-c|-h] [-v ...] [[-b|-f] [c|f]] [-l len] [-n name] [-p n[,n]] [-k] [-x] [-s] [-t|-i] [-g ...] [-w] file
[-c] Coordinate variable data and header information
[-h] Header information only, no data
[-v var1[,...]] Data for variable(s) <var1>,... only
[-b [c|f]] Brief annotations for C or Fortran indices in data
[-f [c|f]] Full annotations for C or Fortran indices in data
[-l len] Line length maximum in data section (default 80)
[-n name] Name for netCDF (default derived from file name)
[-p n[,n]] Display floating-point values with less precision
[-k] Output kind of netCDF file
[-s] Output special (virtual) attributes
[-t] Output time data as date-time strings
[-i] Output time data as date-time strings with ISO-8601 'T' separator
[-g grp1[,...]] Data and metadata for group(s) <grp1>,... only
[-w] With client-side caching of variables for DAP URLs
[-x] Output XML (NcML) instead of CDL
file Name of netCDF file (or URL if DAP access enabled)
netcdf library version 4.4.0 of Mar 26 2016 02:34:09 $

However, I this version is not the ones I have already installed.

Thank you very much for your assistance,

Soroush

mjfconan
Posts: 22
Joined: Mon Mar 03, 2014 1:57 pm
Location: SKLEC, ECNU, China

Re: Installing ROMS on Mac El Captain

#4 Unread post by mjfconan »

Could you please post the output of command: "make install" or "make check", rather than "configure"?

ssorou1
Posts: 10
Joined: Mon Feb 23, 2015 4:29 pm
Location: Louisiana State University

Re: Installing ROMS on Mac El Captain

#5 Unread post by ssorou1 »

I could install and compile ROMS with netcdf-3.6.3. Thanks for assistance. In both netcdf cases, 'make check' command reported back an error. However, 'make' and 'sudo make install' worked out and netcdf versions were installed in desired paths. Despite this error, I tried to compile ROMS with either netcdf versions, pointing to relevant NETCDF_INCDIR and NETCDF_LIBDIR paths. The 3.6.3 version worked out and upwelling case was run successfully, but the 4.3.3 version did not. Hereby, I include the procedure for problematic 4.3.3 version. The procedure for 3.6.3 version was the same.

Regarding netcdf-fortran-4.4.3, after configure, the 'make check' command produces the following error:
> make -j 4
> make -j 4 check

Error message:
.
.
.
"_nc_set_base_pe", referenced from:
_nf_set_base_pe_ in libnetcdff.a(nf_control.o)
"_nc_set_default_format", referenced from:
_nf_set_default_format_ in libnetcdff.a(nf_control.o)
"_nc_set_fill", referenced from:
_nf_set_fill_ in libnetcdff.a(nf_control.o)
"_nc_strerror", referenced from:
_nf_strerror_ in libnetcdff.a(nf_misc.o)
"_nc_sync", referenced from:
_nf_sync_ in libnetcdff.a(nf_control.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [nf_test] Error 1
make[2]: Leaving directory `/Users/soroush/source_builds/netcdf-fortran-4.4.3/nf_test'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/Users/soroush/source_builds/netcdf-fortran-4.4.3/nf_test'
make: *** [check-recursive] Error 1

However, when entering 'sudo make install', it is installed successfully. In build.bash, instead of pointing to /opt/local/include and /opt/local/lib (which was stated in previous posts) I pointed to the folder in which netcdf-fortran-4.4.3 was installed, i.e.:

else
export NETCDF_INCDIR=/Users/soroush/source_builds/netcdf4_f/include
export NETCDF_LIBDIR=/Users/soroush/source_builds/netcdf4_f/lib
fi

Now after compiling:
> ./build.bash

Then this error is reported back towards the end of compilation:

/opt/local/bin/gfortran -frepack-arrays -O3 -ffast-math /Users/soroush/ROMS/projects/upwelling/Build/esmf_roms.o /Users/soroush/ROMS/projects/upwelling/Build/master.o /Users/soroush/ROMS/projects/upwelling/Build/ocean_control.o /Users/soroush/ROMS/projects/upwelling/Build/ocean_coupler.o /Users/soroush/ROMS/projects/upwelling/Build/propagator.o /Users/soroush/ROMS/projects/upwelling/Build/roms_export.o /Users/soroush/ROMS/projects/upwelling/Build/roms_import.o -o /Users/soroush/ROMS/projects/upwelling/oceanS /Users/soroush/ROMS/projects/upwelling/Build/libUTIL.a /Users/soroush/ROMS/projects/upwelling/Build/libNLM.a /Users/soroush/ROMS/projects/upwelling/Build/libNLM_bio.a /Users/soroush/ROMS/projects/upwelling/Build/libNLM_sed.a /Users/soroush/ROMS/projects/upwelling/Build/libANA.a /Users/soroush/ROMS/projects/upwelling/Build/libUTIL.a /Users/soroush/ROMS/projects/upwelling/Build/libMODS.a -L/Users/soroush/source_builds/netcdf4_f/lib -lnetcdf
ld: library not found for -lnetcdf
collect2: ld returned 1 exit status
make: *** [/Users/soroush/ROMS/projects/upwelling/oceanS] Error 1

mjfconan
Posts: 22
Joined: Mon Mar 03, 2014 1:57 pm
Location: SKLEC, ECNU, China

Re: Installing ROMS on Mac El Captain

#6 Unread post by mjfconan »

There may be some bugs in netcdf when doing "make check", and a possible solution is "make" firstly, means "make; make check". As mentioned in the document of netcdf, it is complicated and without "check", there may hide some risks :twisted: (Generally, "install" will never check the capability but simply compile the code). Anyway, if it works, it works.

For the 2nd problem, will you offer your entire build.bash?

ssorou1
Posts: 10
Joined: Mon Feb 23, 2015 4:29 pm
Location: Louisiana State University

Re: Installing ROMS on Mac El Captain

#7 Unread post by ssorou1 »

Yea, its good that it works with netcdf-3.6.3, but I am not sure if some problem occurs at some point or not. At least I tested the upwelling case and did not face any error. Maybe it is due to version of netcdf too, not sure. It would be good if a new version of netcdf would work out as well.

As for the second case, the build.bash file is attached.
Attachments
build.bash
(16.83 KiB) Downloaded 286 times

mjfconan
Posts: 22
Joined: Mon Mar 03, 2014 1:57 pm
Location: SKLEC, ECNU, China

Re: Installing ROMS on Mac El Captain

#8 Unread post by mjfconan »

0) before applying your own netcdf 4.3.3, maybe its "make check" should be passed through at first.
1) since a certain version, netcdf-fortran is splitted out, therefor the environment parameter "LIBS" should be set like this:
"LIBS := -L$(NETCDF_LIBDIR) -lnetcdf -lnetcdff" instead of
"LIBS := -L$(NETCDF_LIBDIR) -lnetcdf"
the file which assigns this variable can be found in trunk/Compilers, because in build.bash you set:

Code: Select all

# Set path of the directory containing makefile configuration (*.mk) files.
# The user has the option to specify a customized version of these files
# in a different directory than the one distributed with the source code,
# ${MY_ROMS_SRC}/Compilers. If this is the case, the you need to keep
# these configurations files up-to-date.

 export         COMPILERS=${MY_ROMS_SRC}/Compilers
2) I use NetCDF4, and its own tool "nf-config", which does the similar things I guess.

Code: Select all

 export       USE_NETCDF4=on            # compile with NetCDF-4 library
...
            export     NC_CONFIG=/***/netcdf4/bin/nf-config

3) Lastly, I am sure the newest version of netcdf-fortran(4.4.3) works well (in all of my cases :D )

Post Reply