Installing HYCOM on macOS Sierra

136 views
Skip to first unread message

Bernardo Oliveira

unread,
Apr 20, 2017, 6:44:44 PM4/20/17
to HYCOM.org Forum
Dear all,

Good evening. I am new user of HYCOM and I am trying to install it on my Mac. The OS is macOS Sierra 12.4 and I am using Intel Fortran Compiler 17 and the latest HYCOM tar bundle (2.2.72).

I am following the steps from document "349_HYCOM_for_Dummies_v2.2.pdf" and the steps from discussion in this link: https://groups.google.com/a/hycom.org/forum/#!searchin/forum/how$20to$20install/forum/j5zR4obiQrU/wAnwTdyhBwAJ

From the pdf, I went through the steps until creation of executables inside of ALL folder. When I try to compile the Make_all.com, there seems to be a problem when compiling the folder hycom/bin. For macOS, I am using the suggestion from the link below to set "Darwin" as OS. Here is the message that returns:

PROCESSING bin:
setenv OS `uname`
uname
if ( Darwin == “Linux” ) then
setenv OS `uname`
uname
if ( Darwin==“Darwin” ) then
if: Expression Syntax.

And then the process stops. Please could you help me?

Many Thanks in advance!

Bernardo Oliveira

alexand...@gmail.com

unread,
Apr 21, 2017, 9:39:36 AM4/21/17
to HYCOM.org Forum
Hi Bernardo, 

since you have an intel compiler on your Mac, I would suggest to compile with the compilation options set for Linux and using ifort (compilation options are not set for Darwin right now). For that you have to add a few lines in the ALL/bin/Make_all.com.

At the beginning of the routine, add:
if ($OS == "Darwin") then
  setenv OS LinuxICE
endif

it should do the trick, 

Alex 

Bernardo Oliveira

unread,
Apr 22, 2017, 3:54:51 PM4/22/17
to HYCOM.org Forum
Hello Alexandra,

First of all, thank you for your answer.

I have followed your suggestion and the compiling process went through the ALL/bin folder. However, the compiling process gave me the log file attached to this message.

According to log file, I believe that there are some compatibility issues regarding my OS and HYCOM routines.

Please, could you help me? Do I have to switch to Linux? In that case, using a virtual machine would work?

Thanks again for your support,

Bernardo Oliveira
Make_all.txt

alexand...@gmail.com

unread,
Apr 24, 2017, 2:08:53 PM4/24/17
to HYCOM.org Forum
Hi Bernardo, 

I've look at your log file and most of the routines were compiled and the executables of those routines were named XXX_LinuxIce because you used the compilation options that were usually for LinuxICE. This is just a naming convention of the script but your routines have been compiled correctly for your Mac.

You might have noticed that some routines that use C did not compile because you do not have icc (intel C compiler) installed. If you absolutely need these routines, try to install icc if you can. Another compiler that works well on Mac is gcc (gfortran is included in the package) that you can download from Macports. I can provide the compilation options for that if you are interested.

Finally, I would like to mention that all the executables in the bin directory are diagnostics tools and most are not used often so it does not matter too much if some do not compile; getting the ones in archive, mean, relax, topo and others is more important.

Alex

Bernardo Oliveira

unread,
Apr 26, 2017, 1:28:17 PM4/26/17
to HYCOM.org Forum
Hi Alexandra,

Thank you for your reply. I have installed icc and the log file attached was generated. Please see if it is OK.

Now I am facing another issue. I have installed Netcdf 4 (both FORTRAN and C tar bundles) using Macports. After that, I have tried to build executables using Make_ncdf.com. Before that, I have edited the Make_ncdf.src to set the environment as shown below:

#
# --- set NCDF to the root directory for netCDF version 3.5 or 3.6 or later.
# --- available from: http://www.unidata.ucar.edu/packages/netcdf/
#
# --- Note that the Fortran 90 routines and module files are required.
#
#setenv NCDF /net/ajax/data/scrf/wallcraf/NETCDF/netcdf-3.5.0
#setenv NCDF /net/ajax/data/scrf/wallcraf/NETCDF/netcdf-3.5.1-intel
#setenv NCDF /net/ajax/data/scrf/wallcraf/NETCDF/netcdf-3.6.0-p1-amd64
#setenv NCDF /u/home/wallcraf/netcdf-3.5.0
#setenv NCDF /common/netcdf-3.6.2-amd64
#setenv NCDF /common/netcdf-3.6.2-amd64pg
#setenv NCDF /common/netcdf/deprecated/netcdf-3.6.2-amd64pg
#
setenv NCDF /opt/local
#
# --- Use EXTRANCDF for the extra libraries needed for NCDF v4
#
#setenv EXTRANCDF "/u/home/wallcraf/pkgs/hdf5-1.8.4-serial/lib/libhdf5_hl.a /u/home/wallcraf/pkgs/hdf5-1.8.4-serial/lib/libhdf5.a /u/home/wallcraf/pkgs/zlib-1.2.3/lib/libz.a"
setenv EXTRANCDF "-L${NCDF}/lib -lnetcdff -lnetcdf"

The NCDF path mentioned is where Macports installed Netcdf 4. When I try to build the NETCDF executables, is shows the message:

MacBook-Pro-de-Bernardo:ALL Bernardo$ sudo port contents netcdf
Password:
Port netcdf contains:
  /opt/local/bin/nc-config
  /opt/local/bin/nccopy
  /opt/local/bin/ncdump
  /opt/local/bin/ncgen
  /opt/local/bin/ncgen3
  /opt/local/include/netcdf.h
  /opt/local/include/netcdf_mem.h
  /opt/local/include/netcdf_meta.h
  /opt/local/lib/cmake/netCDF/netCDFConfig.cmake
  /opt/local/lib/cmake/netCDF/netCDFConfigVersion.cmake
  /opt/local/lib/cmake/netCDF/netCDFTargets-release.cmake
  /opt/local/lib/cmake/netCDF/netCDFTargets.cmake
  /opt/local/lib/libnetcdf.11.3.0.dylib
  /opt/local/lib/libnetcdf.11.dylib
  /opt/local/lib/libnetcdf.dylib
  /opt/local/lib/libnetcdf.settings
  /opt/local/lib/pkgconfig/netcdf.pc
  /opt/local/share/man/man1/nccopy.1.gz
  /opt/local/share/man/man1/ncdump.1.gz
  /opt/local/share/man/man1/ncgen.1.gz
  /opt/local/share/man/man1/ncgen3.1.gz
  /opt/local/share/man/man3/netcdf.3.gz
MacBook-Pro-de-Bernardo:ALL Bernardo$ ./Make_ncdf.com
intelIFC
/opt/local
NCDF =  /opt/local   is not correct

Please, could you help me with this issue?

Thank you once again,

Bernardo
Make_all_2.txt

Alexandra Bozec

unread,
Apr 26, 2017, 1:52:31 PM4/26/17
to Bernardo Oliveira, HYCOM.org Forum
Hi Bernardo, 

From what I see on my Mac, the libnetcdf.a library is not present anymore in the latest NetCDF packages, that is why you have the error "/opt/local is not correct”. However, since you should have the libnetcdff.a library, the compilation should still work. 

When compiling, I usually do it in every directory (archive, relax ...) and not from the top directory because I think I remember it giving me a hard time when I was doing it from there. So doing it from each directory, edit the Make_ncdf.com to make sure to link : libnetcdff.a from the /opt/local/lib, netcdf.mod and typesizes.mod from /opt/local/include into the directory you are compiling. Then run it  … it should work (hopefully) ;o)

Hope that helps, 

Alex
PS: your bin directory is compiled correctly now.

--
--
You received this message because you are a member of HYCOM.org
To ask a question, send an email to fo...@hycom.org

---
You received this message because you are subscribed to a topic in the Google Groups "HYCOM.org Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/a/hycom.org/d/topic/forum/narbNVln7xE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to forum+un...@hycom.org.
<Make_all_2.txt>


Bernardo Oliveira

unread,
Apr 26, 2017, 3:05:03 PM4/26/17
to HYCOM.org Forum, berna...@gmail.com
Thank you for your reply Alexandra.

I edited the Make_all.com according to your suggestion. Now, I am trying to compile from each directory and I got the message: Permission denied.

Please, do you have any clue why this message appears?


Thank you once again,

Bernardo

Alexandra Bozec

unread,
Apr 26, 2017, 3:08:24 PM4/26/17
to fo...@hycom.org, berna...@gmail.com
Either compile with the command "csh Make_all.com" or change the permission on the Make_all.com by doing "chmod 755 Make_all.com” 

One or the other should work …

A.

Bernardo Oliveira

unread,
May 2, 2017, 4:01:37 PM5/2/17
to fo...@hycom.org, berna...@gmail.com
Hi Alexandra,

Sorry for the late response an thank you for your support.

I am trying to compile according to your comments. Most of the proccedures went just fine, but  I am having problems creating executables from Make_ncdf.com for each directory. Fro example:

MacBook-Pro-de-Bernardo:src_2.2.29 Bernardo$ ./Make_ncdf.com
NCDF =  /opt/local
ARCH =  intelIFC
ln: ./netcdf4_f03.mod: File exists
ln: ./netcdf4_nc_interfaces.mod: File exists
ln: ./netcdf4_nf_interfaces.mod: File exists
ln: ./netcdf_f03.mod: File exists
ln: ./netcdf_fortv2_c_interfaces.mod: File exists
ln: ./netcdf_nc_data.mod: File exists
ln: ./netcdf_nc_interfaces.mod: File exists
ln: ./netcdf_nf_data.mod: File exists
ln: ./netcdf_nf_interfaces.mod: File exists
ln: ./libnetcdf.a: File exists
Make failed: force2nc
Make failed: nrl2nc
Make failed: ap_nc
Make failed: kp_nc
Make failed: tp_nc
Make failed: wi_nc

I cannot find the log file that contains the error to analyze what is going wrong. Please could you help me?

Thanks once again,

Bernardo

Alexandra Bozec

unread,
May 2, 2017, 4:05:27 PM5/2/17
to fo...@hycom.org, berna...@gmail.com
Hi Bernardo, 

You should need only those libraries/includes:
#
# --- softlink to netCDF module and library (and typesizes.mod for OSF1 only)
#
/bin/rm -f netcdf.mod libnetcdf.a libnetcdff.a
/bin/rm -f typesizes.mod
#
ln -s ${NCDF}/include/netcdf.mod   .
ln -s ${NCDF}/include/typesizes.mod   .
ln -s ${NCDF}/lib64/libnetcdf.a .
ln -s ${NCDF}/lib64/libnetcdff.a .

And the log files are the Make_* files that appeared in your directory (i.e. Make_force2nc)

Cheers, 
Alex

Bernardo Lopes Almeida de Oliveira

unread,
May 4, 2017, 11:40:35 AM5/4/17
to Alexandra Bozec, HYCOM.org Forum
Good morning Alexandra,

Thank you for your e-mail. I have followed your suggestion below but I don’t have any success so far to compile netcdf executables.

Please find attached the log files. It is important to mention that I am trying to compile netcdf executables from each directory, but they are returning “Make_failed”.

Please could you help me?

Thank you,
 
Bernardo Lopes Almeida de Oliveira
Engenheiro Ambiental, M.Sc
CREA-RJ: 2010114447
Make_wi_nc
Make_force2nc
Make_tp_nc
Make_kp_nc
Make_ap_nc
Make_nrl2nc

Alexandra Bozec

unread,
May 4, 2017, 11:53:10 AM5/4/17
to fo...@hycom.org, berna...@gmail.com
Hi Bernardo, 

Your compilation does not take into account the Netcdf library. Be sure to define your EXTRANCDF library in the Make_ncdf.com and that it is present in the Makefile as well:

This is how I define my libraries in Make_ncdf.com

setenv ARCH intelIFC
setenv NCDF /opt/hpc/intel12/
setenv EXTRANCDF "-L${NCDF}/lib64 -lnetcdf -lnetcdff"
#
echo "NCDF = " $NCDF
echo "ARCH = " $ARCH
#
if (! -e ../../config/${ARCH}_setup) then
  echo "ARCH = " $ARCH "  is not supported"
  exit 1
endif
#
# --- softlink to netCDF module and library (and typesizes.mod for OSF1 only)
#
/bin/rm -f netcdf.mod libnetcdf.a libnetcdff.a
/bin/rm -f typesizes.mod
#
ln -s ${NCDF}/include/netcdf.mod   .
ln -s ${NCDF}/include/typesizes.mod   .
ln -s ${NCDF}/lib64/libnetcdf.a .
ln -s ${NCDF}/lib64/libnetcdff.a .


And in the Makefile, make sure you have the EXTRANCDF for the routines that use Netcdf :

force2nc:                            force2nc.o $(MODS) zh.o
        $(LD) $(LDFLAGS) -o force2nc force2nc.o $(MODS) zh.o $(EXTRANCDF)

nrl2nc:                              nrl2nc.o   $(MODS) zh.o
        $(LD) $(LDFLAGS) -o nrl2nc   nrl2nc.o   $(MODS) zh.o  $(EXTRANCDF)

ap_nc:                       $(MODS) ap_nc.o            $(LIBS)
        $(LD) $(LDFLAGS) -o ap_nc    ap_nc.o    $(MODS) $(LIBS)  $(EXTRANCDF)

kp_nc:                       $(MODS) kp_nc.o            $(LIBS)
        $(LD) $(LDFLAGS) -o kp_nc    kp_nc.o    $(MODS) $(LIBS)  $(EXTRANCDF)

wi_nc:                       $(MODS) wi_nc.o            $(LIBS)
        $(LD) $(LDFLAGS) -o wi_nc    wi_nc.o    $(MODS) $(LIBS)  $(EXTRANCDF)

(Warning: do not directly copy/paste these lines into your Makefile, the copy/paste does not take into account the tabulations at the beginning of the lines that are necessary for the Makefile to work, just copy/paste the $(EXTRANCDF) at the end of the line if it is not already there) 



Best, 

Alex

<Make_wi_nc>
<Make_tp_nc>
<Make_kp_nc>
<Make_ap_nc>
<Make_nrl2nc>
<Make_force2nc>

Bernardo Oliveira

unread,
May 5, 2017, 11:37:11 AM5/5/17
to HYCOM.org Forum
Hi Alexandra,

Please find attached the Makefile and Make_ncdf.com.

Thank you,

Bernardo
Makefile
cópia de Make_ncdf.txt

Alexandra Bozec

unread,
May 5, 2017, 11:46:02 AM5/5/17
to fo...@hycom.org, berna...@gmail.com
Ok, I see, 

In the Makefile remove the libnetcdf.a in all those lines: 

force2nc:                            force2nc.o $(MODS) zh.o   
$(LD) $(LDFLAGS) -o force2nc force2nc.o $(MODS) zh.o    libnetcdf.a $(EXTRANCDF)

nrl2nc:                              nrl2nc.o   $(MODS) zh.o   
$(LD) $(LDFLAGS) -o nrl2nc   nrl2nc.o   $(MODS) zh.o    libnetcdf.a $(EXTRANCDF)

ap_nc:                       $(MODS) ap_nc.o            $(LIBS)
$(LD) $(LDFLAGS) -o ap_nc    ap_nc.o    $(MODS) $(LIBS) libnetcdf.a $(EXTRANCDF)

kp_nc:                       $(MODS) kp_nc.o            $(LIBS)
$(LD) $(LDFLAGS) -o kp_nc    kp_nc.o    $(MODS) $(LIBS) libnetcdf.a $(EXTRANCDF)

tp_nc:                       $(MODS) tp_nc.o            $(LIBS)
$(LD) $(LDFLAGS) -o tp_nc    tp_nc.o    $(MODS) $(LIBS) libnetcdf.a $(EXTRANCDF)

wi_nc:                       $(MODP) wi_nc.o            $(LIBP)
$(LD) $(LDFLAGS) -o wi_nc    wi_nc.o    $(MODP) $(LIBP) libnetcdf.a $(EXTRANCDF)


Use this Make_ncdf.com, and edit the ARCH and NCDF. Don’t forget to check that the directory of your Netcdf library is ${NCDF}/lib or ${NCDF}/lib64 and edit the Make_ncdf.com respectively.

A.

#!/bin/csh
#
#set echo
#
# --- Usage:  ./Make_ncdf.com >& Make_ncdf.log
#
# --- make all netCDF force executables
#
# --- set NCDF to the root directory for netCDF version 3.5.
# --- set ARCH to the correct value for this machine.
#
setenv ARCH intelIFC
setenv NCDF /opt/hpc/intel12/
setenv EXTRANCDF "-L${NCDF}/lib64 -lnetcdf -lnetcdff"
#
echo "NCDF = " $NCDF
echo "ARCH = " $ARCH
#
if (! -e ../../config/${ARCH}_setup) then
  echo "ARCH = " $ARCH "  is not supported"
  exit 1
endif
#
# --- softlink to netCDF module and library (and typesizes.mod for OSF1 only)
#
/bin/rm -f netcdf.mod libnetcdf.a libnetcdff.a
/bin/rm -f typesizes.mod
#
ln -s ${NCDF}/include/netcdf.mod   .
ln -s ${NCDF}/include/typesizes.mod   .
#ln -s ${NCDF}/lib64/libnetcdf.a .
ln -s ${NCDF}/lib64/libnetcdff.a .
#
# --- netCDF force programs
#
foreach m ( force2nc nrl2nc ap_nc kp_nc wi_nc )
  make ${m} ARCH=${ARCH} >&! Make_${m}
  if ($status) then
    echo "Make failed:" ${m}
  else
    echo "Make worked:" ${m}
  endif
end

Bernardo Oliveira

unread,
May 6, 2017, 8:41:25 AM5/6/17
to HYCOM.org Forum
Good morning Alexandra,

I have followed your suggestion. Now I am having the following message:

MacBook-Pro-de-Bernardo:src_2.2.29 Bernardo$ ./Make_ncdf.com
setenv: Too many arguments.

Please find attached the Makefile and Make_ncdf.com to see howit is now after editing.


Thank you,

Bernardo

Em quinta-feira, 20 de abril de 2017 19:44:44 UTC-3, Bernardo Oliveira escreveu:
Makefile
cópia de Make_ncdf.txt
Reply all
Reply to author
Forward
0 new messages