Netcdf downloading via Cygwin

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Netcdf downloading via Cygwin

#1 Unread post by lalvarez »

Hello Everyone

I´m trying to install ROMS via cygwin on a windows 7 OS (64 bits). I have already download and install cygwin, but when I try to download the netCDF (wget https://www.unidata.ucar.edu/downloads/ ... 1.1.tar.gz)I got an Error message that says
ERROR: the certificate of "www.unidata.ucar.edu" is not reliable"
ERROR: the certificate of "www.unidata.ucar.edu" does not have a known host"

I´m not very sure about my traslation on the terms "reliable" and "known host"

Can Anyone help me? Is there any trouble with the wondows 7 OS or the security of the system?

To All of You thanks in advance :(

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#2 Unread post by m.hadfield »

I suggest you download the netCDF source code from the Unidata FTP site with your Web browser. You will need the C and Fortran libraries:

ftp://ftp.unidata.ucar.edu/pub/netcdf/n ... 1.1.tar.gz
ftp://ftp.unidata.ucar.edu/pub/netcdf/n ... 4.2.tar.gz

If you want any help regarding prerequisites and configure options, please reply in this thread.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#3 Unread post by lalvarez »

M.hadfield

Thank You very much for that tip, i also was wondering how to install the fortran & C libreries

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#4 Unread post by m.hadfield »

OK, you install the C library then the Fortran library. The C library optionally depends on several other prerequisite packages. If you want to be able to produce files in netCDF-4 format then you need HDF5. If you want to use OpenDAP then you need Curl. Also, in recent versions of netCDF, building the documentation requires a package called doxygen. And there are other packages involved by the build process. Luckily, I have done all this stuff so you don't need to discover it all for yourself.

All the prerequisite packages that I've mentioned can be installed via Cygwin setup. The ones that I can think of that you need/want are:

gcc4-core
gcc4-fortran
bison
doxygen
curl
libcurl-devel
make
udunits
hdf5
libhdf5-devel

Once you've selected all these in Cygwin setup (some may already be installed) the setup program may tell you that they depend on some other packages that you haven't selected and ask if you want those too. Say yes.

Here are the commands that I use to build netCDF under Cygwin. For the C library

version=netcdf-4.2
cd ${HOME}/tmp
tar -xvzf /cygdrive/c/software/netcdf/${version}.tar.gz
cd ${version}
nice ./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap
nice make
nice make check
nice make install

And for the Fortran library

version=netcdf-fortran-4.2
cd ${HOME}/tmp
tar -xvzf /cygdrive/c/software/netcdf/${version}.tar.gz
cd ${version}
CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
nice make
nice make check
nice make install

These are just variants of the standard procedure for building open source sofgtware on Unix. Note that /cygdrive/c/software/netcdf/ is the location I have saved my netCDF source files to and ${HOME}/tmp is my temporary directory for Cygwin.

If it fails it will probably be because some prerequisite is missing. This can be sorted out.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#5 Unread post by lalvarez »

M.hadfield hello

One more question, Does all the files from the netcdf-4.2.1.1.tar.gz and netcdf-fortran-4.2.tar.gz must be decompressed in the same directory?

Thanks in advance

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#6 Unread post by kate »

No, let them each have their own directory.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#7 Unread post by m.hadfield »

What Kate says. But what may not be immediately clear from my last post is that the files for the C and Fortran libraries are unpacked into different directories, because the tar archives contain subdirectories that match the archive names (without the .tar.gz bit). This is why the 4th command in each sequence is "cd ${version}".

Incidentally the convention that a source code archive foo-x.x.tar.gz contains a subdirectory foo-x.x is very commonly followed in the open source world, but there are exceptions.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#8 Unread post by lalvarez »

Kate & M.Hadfield

Thanks a lot for Your comments, I have include all the packages you recommend me in the cygwin installing. Today I´m going to check the configure, make etc. Hope it runs well and then ROMS

Thanks again

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#9 Unread post by kate »

I should warn you that with installing it as two packages, the command "nc-config --flibs" may not work. If so, the proper command is "nf-config --flibs". This is invoked in the Makefile via the components in the Compilers directory when selecting NETCDF4=on.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#10 Unread post by lalvarez »

Hello Kate

In deed, when I write

CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local

i got a message that says

-bash: nf-config: not found

I suppose that, what is written between quotations LIBS="$(nc-config --libs)", is it the whole direction where these libs are?

I guess it´s basic, but anyway, i got to learn some how :oops:

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#11 Unread post by kate »

lalvarez wrote:Hello Kate

In deed, when I write

CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local

i got a message that says

-bash: nf-config: not found

I suppose that, what is written between quotations LIBS="$(nc-config --libs)", is it the whole direction where these libs are?

I guess it´s basic, but anyway, i got to learn some how :oops:
Oops, I should have said I was talking about the ROMS makefile, after all the netcdf stuff is built and installed. It looks like you are still working on the install phase. Anyway "$(nc-config --libs)" is not the correct syntax. It is saying that whole expression is a variable of some kind due to the "$".

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#12 Unread post by lalvarez »

Hello Kate

I´ve been reading the M.Hadfield comment about the installing, i guess you´re right because he says:

This is why the 4th command in each sequence is "cd ${version}"

i think it is the directory where the ./configure has to take place

I´m going to check once again the cygwin installing, not to miss any package or subpackage and try to configure the C & Fortran libraries needed to get the netcdf tunned.

I´m new on this, have to learn a lot

Thank for your time

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#13 Unread post by m.hadfield »

kate wrote:...Anyway "$(nc-config --libs)" is not the correct syntax. It is saying that whole expression is a variable of some kind due to the "$".
The configure command that I suggested, namely

Code: Select all

CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
should work (and does work for me) to configure netcdf-fortran once the basic netcdf-C library is installed. As you say, the $() expression loads the output of "nc-config --libs" into the LIBS variable and this then forms part of the environment for the configure script.
$ LIBS=$(nc-config --libs)
$ echo $LIBS
-L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#14 Unread post by m.hadfield »

Hi lalvarez

Please don't hesitate to ask for further help if you need it.

A few messages back you referred to an error you got from the configure command for the netCDF-Fortran package (because you misunderstood a comment by Kate and substituted nf-config for nc-config). But you should have only been trying to configure netCDF-Fortran if you had successfully installed netCDF-C. Have you?

To check if you have installed netCDF-C properly, try running the nc-config command in a Bash shell. Here's what it gives for me:

Code: Select all

$ nc-config
Usage: nc-config [OPTION]

Available values for OPTION include:

  --help        display this help message and exit
  --all         display all options
  --cc          C compiler
  --cxx         C++ compiler
  --fc          Fortran compiler
  --cflags      pre-processor and compiler flags
  --fflags      flags needed to compile a Fortran program
  --has-dap     whether OPeNDAP is enabled in this build
  --has-nc2     whether NetCDF-2 API is enabled
  --has-nc4     whether NetCDF-4/HDF-5 is enabled in this build
  --has-hdf5    whether HDF5 is used in build (always the same as --has-nc4)
  --has-hdf4    whether HDF4 was used in build
  --has-pnetcdf whether parallel-netcdf (a.k.a. pnetcdf) was used in build
  --has-f77     whether Fortran 77 API is enabled in this build
  --has-f90     whether Fortran 90 API is enabled in this build
  --has-c++     whether C++ API is enabled in this build
  --has-szlib   whether szlib is included in build
  --libs        library linking information for netcdf
  --flibs       libraries needed to link a Fortran program
  --prefix      Install prefix
  --includedir  Include directory
  --version     Library version
And you can also run it with any of the options listed, The "--all" option is handy as it lists everything.

Code: Select all

$ nc-config --all

This netCDF 4.2 has been built with the following features:

  --cc        -> gcc
  --cflags    ->  -I/usr/local/include
  --libs      -> -L/usr/local/lib  -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

  --cxx       -> @CXX@
  --has-c++   -> @HAS_CXX@

  --fc        -> @FC@
  --fflags    -> @FFLAGS@ @MOD_FLAG@/usr/local/include
  --flibs     -> -L/usr/local/lib @NC_FLIBS@
  --has-f77   -> @HAS_F77@
  --has-f90   -> @HAS_F90@

  --has-dap   -> yes
  --has-nc2   -> yes
  --has-nc4   -> yes
  --has-hdf5  -> yes
  --has-hdf4  -> no
  --has-pnetcdf-> no
  --has-szlib ->

  --prefix    -> /usr/local
  --includedir-> /usr/local/include
  --version   -> netCDF 4.2
If nc-config doesn't run, then either your installation has failed or your shell just can't find the nc-config script, which should have been installed in /usr/local/bin/nc-config. Check that this file exists and check that /usr/local/bin is one of the directories listed in your PATH variable.

By the way, if/when you install netCDF-Fortran successfully a second script called nf-config will be installed in /usr/local/bin. Here's what my copy prints:

Code: Select all

niwa-34272 $ nf-config --all

This netCDF-Fortran 4.2 has been built with the following features:

  --cc        -> gcc
  --cflags    ->  -I/usr/local/include -I/usr/local/include
  --libs      -> -L/usr/local/lib  -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

  --fc        -> gfortran
  --fflags    -> -g -O2 -I/usr/local/include
  --flibs     -> -L/usr/local/lib -lnetcdff  -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
  --has-f90   -> yes

  --has-nc2   -> yes
  --has-nc4   -> yes

  --prefix    -> /usr/local
  --includedir-> /usr/local/include
  --version   -> netCDF-Fortran 4.2
As Kate says, this is the one you need to tell ROMS how to use netCDF.

The netCDF developers got the idea of using "config" scripts from curl-config, which is part of the Curl library. NetCDF-4 has so many different options that a mechanism like this is essential to keep track of them.

Mark

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#15 Unread post by lalvarez »

Hello M.Hadfield

I´ve been working in the netcdf installing, first steps:

1) decompressing the netcdf-4.2.1.1.tar.gz - OK
2) nice ./configure ...etc - Ok
3) nice make - Not ok and at the end I get this

ocinternal.c:28:2: error: invalid preprocessing directive #elifdef
ocinternal.c:29:0: warning: "TMPPATH1" redefined
ocinternal.c:26:0: note: this is the location of the previous definition
ocinternal.c:30:0: warning: "TMPPATH2" redefined
ocinternal.c:27:0: note: this is the location of the previous definition
Makefile:427: recipe for target `liboc_la-ocinternal.lo' failed
make[2]: *** [liboc_la-ocinternal.lo] Error 1
make[2]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/oc'
Makefile:500: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1'
Makefile:371: recipe for target `all' failed
make: *** [all] Error 2


4) nice make check - Not ok, at the end I get this

ocinternal.c:28:2: error: invalid preprocessing directive #elifdef
ocinternal.c:29:0: warning: "TMPPATH1" redefined
ocinternal.c:26:0: note: this is the location of the previous definition
ocinternal.c:30:0: warning: "TMPPATH2" redefined
ocinternal.c:27:0: note: this is the location of the previous definition
Makefile:427: recipe for target `liboc_la-ocinternal.lo' failed
make[1]: *** [liboc_la-ocinternal.lo] Error 1
make[1]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/oc'
Makefile:500: recipe for target `check-recursive' failed
make: *** [check-recursive] Error 1


5) nice make install - Not Ok, an I get this

ocinternal.c:28:2: error: invalid preprocessing directive #elifdef
ocinternal.c:29:0: warning: "TMPPATH1" redefined
ocinternal.c:26:0: note: this is the location of the previous definition
ocinternal.c:30:0: warning: "TMPPATH2" redefined
ocinternal.c:27:0: note: this is the location of the previous definition
Makefile:427: recipe for target `liboc_la-ocinternal.lo' failed
make[1]: *** [liboc_la-ocinternal.lo] Error 1
make[1]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/oc'
Makefile:500: recipe for target `install-recursive' failed
make: *** [install-recursive] Error 1



Any clue, why is this happening

Also a question, Does nice = ~ ?
Thanks in advance

Leo

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#16 Unread post by m.hadfield »

Hi Leo

I get the same error with netdf-4.2.1.1. It also occurs with 4.2.1. I suggest you install netcdf-4.2. I will check this problem out further and report it to the netCDF developers.

"nice" is a utility that runs executables at a reduced priority.

Mark

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#17 Unread post by m.hadfield »

Hi Leo

The compilation problem occurs because the file in question, oc/ocinternal.c, contains the preprocessor directive "elifdef", which is not valid. Here is the offending block of code

Code: Select all

/* Note: TMPPATH must end in '/' */
#ifdef __CYGWIN__
#define TMPPATH1 "/cygdrive/c/temp/"
#define TMPPATH2 "./"
#elif defined WIN32
#define TMPPATH1 "c:\\temp/"
#define TMPPATH2 ".\\"
#else
#define TMPPATH1 "/tmp/"
#define TMPPATH2 "./"
#endif
To work around it, follow the installation procedure up to the point where the error occurs, then edit ./oc/ocinternal.c, replacing "#elifdef" with "#elif defined". (You will need to use a text editor that preserves Unix line terminators. I use a Windows application called Textpad. Other possibilities are emacs and xemacs, both available via Cygwin setup. Then there's--shudder--vi.) Then run "make" again and continue through "make check" and "make install".

netcdf-4.2.1.1 is alleged to contain amny improvements and bug fixes over netcdf-4.2, so now my recommendation is to install that with the above workaround.

I am about to report this to NetCDF Support.

Mark

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#18 Unread post by lalvarez »

Hello Mark

Is there a specific way to uninstall the netcdf directories and libraries or this can be done directrly from the windows explorer?

Thanks in advance

Leo

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#19 Unread post by lalvarez »

Mark hello again

First, pay no attention to my last post.

Well things´re going like this I changed the #elifdef for the #elif defined in the ./oc/ocinternal.c, and then I made the nice ./configure ...etc again, and it ran well.

But when I made de nice make check I got this:

================================================
1 of 8 tests failed
Please report to support-netcdf@unidata.ucar.edu
================================================
Makefile:596: recipe for target `check-TESTS' failed
make[4]: *** [check-TESTS] Error 1
make[4]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:746: recipe for target `check-am' failed
make[3]: *** [check-am] Error 2
make[3]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:467: recipe for target `check-recursive' failed
make[2]: *** [check-recursive] Error 1
make[2]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:749: recipe for target `check' failed
make[1]: *** [check] Error 2
make[1]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:500: recipe for target `check-recursive' failed
make: *** [check-recursive] Error 1

Are there other commands that have to be changed in the scripts?

Can You get me a hand on this?

Thanks in advance
Leo

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#20 Unread post by m.hadfield »

Hi Leo

"make check" worked fine for me once I'd worked around the #elifdef bug.

I can't tell the cause of the error with the output you've shown. Could you please include the entire make check output as an attachment, or email it to me separately.

Mark

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#21 Unread post by m.hadfield »

Incidentally, both Kate and I have said on this thread that if you are installing the netCDF C and Fortran libraries separately (which is how they're packaged nowadays) then the command that the ROMS make file needs to call to determine the location of libraries and include files is nf-config, not nc-config. (The latter is installed with the C library and the former with the Fortran library.) Well we were wrong. If you have installed the latest versions of both packages (netcdf-4.1.1 and netcdf-fortran-4.2) then the Fortran modifies nc-config so that it knows about all the Fortran stuff. Eg, here is the output of nc-config on my Cygwin system:

Code: Select all

$ nc-config --all

This netCDF 4.2.1.1 has been built with the following features:

  --cc        -> gcc
  --cflags    ->  -I/usr/local/include
  --libs      -> -L/usr/local/lib  -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

  --has-c++   -> no
  --cxx       ->
  --has-c++4  -> no
  --cxx4      ->

  --fc        -> gfortran
  --fflags    -> -g -O2 -I/usr/local/include
  --flibs     -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
  --has-f90   -> yes

  --has-dap   -> yes
  --has-nc2   -> yes
  --has-nc4   -> yes
  --has-hdf5  -> yes
  --has-hdf4  -> no
  --has-pnetcdf-> no
  --has-szlib ->

  --prefix    -> /usr/local
  --includedir-> /usr/local/include
  --version   -> netCDF 4.2.1.1
Clever, eh?

csherwood
Posts: 39
Joined: Fri Apr 02, 2004 4:46 pm
Location: USGS, Woods Hole, USA

Re: Netcdf downloading via Cygwin

#22 Unread post by csherwood »

nc-config is great...but one caution: if you have done multiple attempts...especially unsuccessful attempts...at building or installing the netcdf libraries, you may have more than one nc-config script around, and you'll get the results from the first one encountered on your path. I don't think nc-config actively checks your installation like ./configure does...it just parrots a list of information. So if you run the wrong one, you'll get the wrong info.
Chris Sherwood, USGS
1 508 457 2269

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#23 Unread post by m.hadfield »

Thanks for those warnings, Chris.

Remember that the ROMS makefile uses a variable called NC_CONFIG to find nc-config. The default is "nc-config", but you can override it via an environment variable.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#24 Unread post by lalvarez »

Hello Mark

I´ve sent You an e-mail with the make check results, i highlighted what i think is the problem

Thanks in advance

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#25 Unread post by m.hadfield »

Thanks, Leo.

It failed during an OpenDAP test with a "Cannot locate test server" error. However it had already run a series of OpenDAP tests. This is probably just an isolated connectivity problem. It is safe to ignore it and install netCDF.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#26 Unread post by lalvarez »

Hi Mark

Thanks for the news on my birthday, jaja. When the make chech failed, i didnot run the make install, i´ll finish to install the netcdf for tomorrow, i hope.

Thanks a lot

Leo

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#27 Unread post by lalvarez »

I have succesfully install the netcdf & netcdf-fortran

Thank a lot Mark & Kate

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#28 Unread post by lalvarez »

Just for the record

I once asked for this error:

================================================
1 of 8 tests failed
Please report to support-netcdf@unidata.ucar.edu
================================================
Makefile:596: recipe for target `check-TESTS' failed
make[4]: *** [check-TESTS] Error 1
make[4]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:746: recipe for target `check-am' failed
make[3]: *** [check-am] Error 2
make[3]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:467: recipe for target `check-recursive' failed
make[2]: *** [check-recursive] Error 1
make[2]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:749: recipe for target `check' failed
make[1]: *** [check] Error 2
make[1]: se sale del directorio `/home/Usuario/software/netcdf-4.2.1.1/ncdap_test'
Makefile:500: recipe for target `check-recursive' failed
make: *** [check-recursive] Error 1



That was caused by this failure

Cannot locate test server
FAIL: test_partvar.exe
*** Test: varm on URL: http://motherlode.ucar.edu/thredds/dods ... atology.nc



Well I wrote to UNICAR and this is what I get, an extra command must be include in the configure, so insted of:

nice ./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap

it is:

./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests

and no error appear in the netcdf and netcdf-fortran configuration

Have a nice day

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#29 Unread post by m.hadfield »

Thanks for the follow-up, Leo :)

robjenkinsiii
Posts: 34
Joined: Tue Jan 22, 2013 5:28 pm
Location: University of Delaware

Re: Netcdf downloading via Cygwin

#30 Unread post by robjenkinsiii »

Hi all,

I've been starting to install ROMS via Cygwin, but I've gotten stuck on installing NetCDF.

Following the tutorial instructions here: https://www.myroms.org/wiki/index.php/ROMS_Cygwin
The only exception I made to these steps was to replace the download link for netcdf-3.6.2 with that of netcdf-fortran-4.2.2
I did not alter the compilation command from the tutorial page.
I'm up to the "make check" step, at which point I get the following error message:

----------------------------------------------------------------------------
----------------------------------------------------------------------------
$ make check
Making check in f90
make[1]: Entering directory `/home/Robert/software/netcdf-fortran-4.2/f90'
make check-am
make[2]: Entering directory `/home/Robert/software/netcdf-fortran-4.2/f90'
/bin/sh ../libtool --tag=FC --mode=link gfortran-4 -g -O2 -o libnetcdff90.la typeSizes.lo netcdf4.lo -lnetcdf
/usr/bin/grep: /usr/lib/libhdf5_hl.la: No such file or directory
/usr/bin/sed: can't read /usr/lib/libhdf5_hl.la: No such file or directory
libtool: link: `/usr/lib/libhdf5_hl.la' is not a valid libtool archive
Makefile:336: recipe for target `libnetcdff90.la' failed
make[2]: *** [libnetcdff90.la] Error 1
make[2]: Leaving directory `/home/Robert/software/netcdf-fortran-4.2/f90'
Makefile:514: recipe for target `check' failed
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/Robert/software/netcdf-fortran-4.2/f90'
Makefile:422: recipe for target `check-recursive' failed
make: *** [check-recursive] Error 1
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

After reading the help above, I'm wondering, do I need to back and follow those instructions, too? It seems like there might be a known fix for handling these missing 'libhdf5_hl.la' & 'libnetcdff90.la'

Thank you in advance.

EDIT: After re-reading, it seems I should have made selections upon setting up cygwin in order to properly install the newest netcdf. Does this require un/re-installing cygwin?

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#31 Unread post by m.hadfield »

Have you installed HDF5? It's available via the Cygwin setup utility. You need the hdf5 and libhdf5-devel packages, and also maybe libhdf5_7 (but I think that gets installed automatically with the other two.)

robjenkinsiii
Posts: 34
Joined: Tue Jan 22, 2013 5:28 pm
Location: University of Delaware

Re: Netcdf downloading via Cygwin

#32 Unread post by robjenkinsiii »

I have not and I noticed this in your earlier posts. This might seem like a silly question (I'm very new to all of this), but does this require that I uninstall cygwin and reinstall with the appropriate packages or is there a simpler way to handle this?

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#33 Unread post by m.hadfield »

robjenkinsiii wrote:I have not and I noticed this in your earlier posts. This might seem like a silly question (I'm very new to all of this), but does this require that I uninstall cygwin and reinstall with the appropriate packages or is there a simpler way to handle this?
No you should not need to uninstall & reinstall.

The usual way to install Cygwin is to run setup.exe:

http://cygwin.com/setup.exe

This keeps track of what you've installed. Each time you run it again, it goes to a Cygwin mirror site, retrieves a list of the packages currently there and offers to update any package that has changed. You can also select a package that hasn't been installed previously. If a package you're installing depends on anything that's not installed, then if offers to get that one too. It's pretty slick.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#34 Unread post by lalvarez »

Mark

Thanks for that tip, i´m going to update my laptop ROMS!!

Also I´ve finally install ROMS all the way, thanks for Your help

Greetings

robjenkinsiii
Posts: 34
Joined: Tue Jan 22, 2013 5:28 pm
Location: University of Delaware

Re: Netcdf downloading via Cygwin

#35 Unread post by robjenkinsiii »

M.hadfield, Thanks again, with your instructions and with the heads up about the 'oc' errors I was able to successfully install netCDF!

Now on to the next errors in compiling ROMS :D

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#36 Unread post by lalvarez »

Hello robjenkinsiii

Just as Mark says, for the netCDF installing follow this posts and pay attention to the
Well I wrote to UNICAR and this is what I get, an extra command must be include in the configure, so insted of:

nice ./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap

it is:

./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests

and no error appear in the netcdf and netcdf-fortran configuration
Have a nice day

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#37 Unread post by PedroMarques »

Hello everyone,

This is my first post. I successfully installed netcdf-4.2.1.1 but I'm having problems installing netcdf-fortran-4.2. I used the following line command:

CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local

and I got:

.
.
.
checking for C-equivalent to Fortran routine "SUB"... sub_
checking for Fortran "byte"... yes
checking for Fortran "integer*2"... yes
checking if Fortran "byte" is C "signed char"... configure: error: Could not link conftestf.o and conftest.o


Anyone have an idea what might be happening?

Thanks in advance.
Pedro

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#38 Unread post by kate »

I don't know what happened there, but I do know that configure leaves behind log files of what it tried, including the codes it tried to compile.

Here is what I tried last (and succeeded with):

Code: Select all

 $ configure --prefix=/u1/uaf/kate LDFLAGS=-L/u1/uaf/kate/lib CPPFLAGS=-I/u1/uf
/kate/include FFLAGS=-fno-second-underscore F77FLAGS=-fno-second-underscore F90F
LAGS=-fno-second-underscore
(I'm not sure how many FFLAGS are used now.)

Maybe you could try changing your LIBS to LDFLAGS.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#39 Unread post by m.hadfield »

I'm stumped. I suspect configure is failing the first time it tries to link Fortran and C code together. But I don't know why that would happen. You're on Cygwin, right? On Linux you probably wouldn't want "--disable-shared".

You could sort out what's happening by trying to reproduce the command that configure is running at the point of failure and looking at the error output. Unfortunately configure makes that difficult for you by capturing the output of the command and then deleting temporary files when it's finished. You'd think configure would have a "don't delete temporary files switch". Perhaps it does.

You might want to look at the output of "nc-config --libs" to check it looks OK. However if you've just built and installed netcdf-4.2.1, I can't imagine why it wouldn't be. You did install netcdf-4.2.1, didn't you? In the same prefix location as you're using for netcdf-4.2-fortran?

BTW, you shouldn't need the "-fno-second-underscore" stuff that Kate shows. Recent versions of netCDF handle all that for you.

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#40 Unread post by PedroMarques »

Thanks Mark and Kate for your comments.

Yes, I'm using Cygwin.
I experienced downloading some more gcc packages and after that I was able to install netcdf-fortran-4.2. :D
Now, I'm trying to compile the upwelling test case but something is going wrong.
I followed all steps in WikiROMS tutorial and I get these messages when I try to compile:


Pedro@Noronha ~/roms/projects/upwelling
$ ./build.bash
rm -f -r core *.ipo /home/pedro/roms/Projects/Upwelling/Build /home/Pedro/make_m acros.mk
makefile:238: INCLUDING FILE /home/Pedro/make_macros.mk WHICH CONTAINS APPLICATI ON-DEPENDENT MAKE DEFINITIONS
cp -f /opt/gfortransoft/serial/netcdf3/include/netcdf.mod /home/pedro/roms/Proje cts/Upwelling/Build
cp: impossível obter estado de "/opt/gfortransoft/serial/netcdf3/include/netcdf. mod": No such file or directory
make: *** Sem regra para processar o alvo `/home/pedro/roms/Projects/Upwelling/B uild/MakeDepend', necessário por `all'. Pare.



Any tip?

Regards,
Pedro

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#41 Unread post by kate »

"/opt/gfortransoft/serial/netcdf3/include/netcdf. mod": No such file or directory
Does this file indeed not exist? If you built netcdf, where did you put it?

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#42 Unread post by PedroMarques »

Yeah, it not exist.
Inside "opt" folder there is only one folder called "gcc-tools".

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#43 Unread post by m.hadfield »

Hi PedroMarques

The configure command you gave several posts back specified an installation prefix of /usr/local. Is that where you installed netCDF and netCDF-Fortran? If so, why is ROMS looking for netcdf.mod under /opt? (I myself don't have a Cygwin /opt directory. All user-installed software goes in /usr/local.)

I suggest you:
  • Check where you installed netCDF.
  • Check the bin subdirectory of this location (eg. /usr/local/bin) is on your path.
  • Check the output of "nc-config --all" and "nf-config --all" and make sure it looks OK.
  • Check you are building ROMS with USE_NETCDF4 defined (which you can do in build.bash).
Here is the code in CYGWIN-gfortan.mk that specifies where make should be looking for netCDF files

Code: Select all

ifdef USE_NETCDF4
        NC_CONFIG ?= nc-config
    NETCDF_INCDIR ?= $(shell $(NC_CONFIG) --prefix)/include
             LIBS := $(shell $(NC_CONFIG) --flibs)
else
    NETCDF_INCDIR ?= /usr/local/include
    NETCDF_LIBDIR ?= /usr/local/lib
             LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
endif
If USE_NETCDF4 is defined and nc-config is reporting the right info about your netCDF installation then everything should work OK. If not, it's anyone's guess what will happen.

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#44 Unread post by PedroMarques »

Hi Mark,

netCDF and netCDF-fortran were installed in /usr/local.
The output of "nc-config --all" and "nf-config --all" looks ok for me. See below:

Pedro@Noronha ~/roms/projects/upwelling
$ nc-config --all

This netCDF 4.2.1.1 has been built with the following features:

--cc -> gcc
--cflags -> -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->

--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes

--has-dap -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-pnetcdf-> no
--has-szlib ->

--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF 4.2.1.1


Pedro@Noronha ~/roms/projects/upwelling
$ nf-config --all

This netCDF-Fortran 4.2 has been built with the following features:

--cc -> gcc
--cflags -> -I/usr/local/include -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl

--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes

--has-nc2 -> no
--has-nc4 -> no

--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF-Fortran 4.2


I was not building ROMS with netCDF4. But now I changed in build.bash and makes no difference. ROMS still looking for netcdf.mod in opt folder.


#export USE_DEBUG=on # use Fortran debugging flags
export USE_LARGE=on # activate 64-bit compilation
export USE_NETCDF4=on # compile with NetCDF-4 library
#export USE_PARALLEL_IO=on # Parallel I/O with Netcdf-4/HDF5



How can I check if usr/local/bin subdirectory is on my path?

Thanks for your support.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#45 Unread post by kate »

This system is quite flexible, but it can be tricky. Do you have any environment variables set, such as:

Code: Select all

delta.arsc.edu 180% printenv | grep NET
NETCDF_INCDIR=/usr/local/pkg/netcdf/netcdf-4.1.pgi/include
NETCDF_LIBDIR=/usr/local/pkg/netcdf/netcdf-4.1.pgi/lib
delta.arsc.edu 181% printenv NC_CONFIG
/u1/uaf/kate/bin/nc-config
Note that this is on the same system, pointing to two places. One is for the PGI compiler, the other for gfortran. I'm always tripping over this.

You need to find where that /opt is coming from, be it environment or build script. If neither is setting anything, is it coming from the Compilers/xxx_xxx.mk file? Do you know which you are using?

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#46 Unread post by m.hadfield »

PedroMarques wrote:How can I check if usr/local/bin subdirectory is on my path?
It looks like this directory is on your path, as you can call nc-config and nf-config without including the full name (which is what you want to happen, and the reason why I asked about the path).

So, as Kate says, something else is telling ROMS make to look for netcdf.mod under /opt.

But to answer your question, you can see the contents of the path with

Code: Select all

echo $PATH
If it's long you can search for a specific substring

Code: Select all

echo $PATH | grep "/usr/local/bin"
If you want to know the full name of the file invoked by the "nc-config" command you can use this

Code: Select all

type nc-config

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#47 Unread post by PedroMarques »

Hi Kate & Mark

I believe I found what was going wrong.
The tutorial (https://www.myroms.org/wiki/index.php/ROMS_Cygwin) in 'Customizing the Build Script' section explain to replace these 2 lines in build.bash:

export NETCDF_INCDIR=/opt/gfortransoft/serial/netcdf3/include
export NETCDF_LIBDIR=/opt/gfortransoft/serial/netcdf3/lib


by

export NETCDF_INCDIR=/usr/local/include
export NETCDF_LIBDIR=/usr/local/lib


I also changed these lines:

export NC_CONFIG=/opt/gfortransoft/serial/netcdf4/bin/nc-config
export NETCDF_INCDIR=/opt/gfortransoft/serial/netcdf4/include


to

export NC_CONFIG=/usr/local/bin/nc-config
export NETCDF_INCDIR=/usr/local/include


After these modifications I compiled and everything was looking great until appears this error:

.
.
.
cd /home/pedro/roms/Projects/Upwelling/Build; /usr/bin/gfortran-4 -c -frepack-arrays -O3 -ffast-math master.f90
/usr/bin/gfortran-4 -frepack-arrays -O3 -ffast-math /home/pedro/roms/Projects/Upwelling/Build/esmf_roms.o /home/pedro/roms/Projects/Upwelling/Build/master.o /home/pedro/roms/Projects/Upwelling/Build/ocean_control.o /home/pedro/roms/Projects/Upwelling/Build/ocean_coupler.o /home/pedro/roms/Projects/Upwelling/Build/propagator.o /home/pedro/roms/Projects/Upwelling/Build/roms_export.o /home/pedro/roms/Projects/Upwelling/Build/roms_import.o -o /home/pedro/roms/Projects/Upwelling/oceanS.exe /home/pedro/roms/Projects/Upwelling/Build/libUTIL.a /home/pedro/roms/Projects/Upwelling/Build/libNLM.a /home/pedro/roms/Projects/Upwelling/Build/libNLM_bio.a /home/pedro/roms/Projects/Upwelling/Build/libNLM_sed.a /home/pedro/roms/Projects/Upwelling/Build/libANA.a /home/pedro/roms/Projects/Upwelling/Build/libUTIL.a /home/pedro/roms/Projects/Upwelling/Build/libMODS.a -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarput.o): In function `NC_put_vara':
/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarput.c:16: undefined reference to `___chkstk_ms'
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarput.o): In function `NC_put_var':
/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarput.c:37: undefined reference to `___chkstk_ms'
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarput.o): In function `NCDEFAULT_put_varm':
/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarput.c:85: undefined reference to `___chkstk_ms'
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarget.o): In function `NC_get_vara':
/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarget.c:18: undefined reference to `___chkstk_ms'
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarget.o): In function `NC_get_var':
/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarget.c:42: undefined reference to `___chkstk_ms'
/usr/local/lib/libnetcdf.a(libdispatch_la-dvarget.o):/home/Pedro/software/netcdf-4.2.1.1/libdispatch/dvarget.c:85: more undefined references to `___chkstk_ms' follow
collect2: ld returned 1 exit status
make: ** [/home/pedro/roms/Projects/Upwelling/oceanS.exe] Erro 1

Pedro@Noronha ~/roms/projects/upwelling



:?

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#48 Unread post by kate »

That's one I haven't seen before. Doing a web search brings up this tidbit:
As this chkstk_ms is a internal symbol of gcc's libgcc library and
works on my 32-bit compilers without issues. So please check that you
don't mix here different compiler-version runtime-libraries.
I don't know that that helps, but did you change anything with gcc between building netcdf and now?

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#49 Unread post by PedroMarques »

Yes, I did.

NetCDF installation was ok.
NetCDF-Fortran installation was not ok, so, I downloaded some more gcc packages. After that I was able to install netCDF-Fortran successfully.

The packages that I have are:

cologcc 1.3.2-2
gcc-core 3.4.4-999
gcc-g77 3.4.4-999
gcc-mingw-core 20050522-3
gcc-mingw-g77 20050522-3
gcc-tools-epoch1-autoconf 2.59-1
gcc-tools-epoch1-automake 1.9.6-1
gcc-tools-epoch2-autoconf 2.64-1
gcc-tools-epoch2-automake 1.11.1-1
gcc4 4.5.3-3
gcc4-ada 4.5.3-3
gcc4-core 4.5.3-3
gcc4-debuginfo 4.7.2-2
gcc4-fortran 4.5.3-3
gcc4-g++ 4.5.3-3
gcc4-java 4.5.3-3
gcc4-objc 4.5.3-3
gccmakedep 1.0.2-1
libgcc1 4.5.3-3

PedroMarques
Posts: 7
Joined: Fri Apr 12, 2013 12:40 pm
Location: Prooceano

Re: Netcdf downloading via Cygwin

#50 Unread post by PedroMarques »

Good news!!!
I installed netcdf and netcdf-fortran again and now ROMS is running! :D
Now the game will start!

agilroy
Posts: 5
Joined: Wed Jul 30, 2014 11:04 pm
Location: UCSD-SIO

Re: Netcdf downloading via Cygwin

#51 Unread post by agilroy »

Hello,
I have been following the guidelines above to get ROMS going on my computer. I have installed the following Cygwin packages
gcc4-core
gcc4-fortran
bison
doxygen
curl
libcurl-devel
make
udunits
hdf5
libhdf5-devel
libhdf5_7,
as well as netcdf-4.2.1.1 and netcdf-fortran-4.2. However, when I try to run my build.bash file, I get the following errors:

/home/Angelica/roms/Projects/Upwelling/Build/libMODS.a -L/usr/local/lib -lnetcdff -lnetcdf
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `nc_def_var_nc4':
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:469: undefined reference to `H5Tget_native_type'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `nc4_reopen_dataset':
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:50: undefined reference to `H5open'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:50: undefined reference to `H5P_CLS_DATASET_ACCESS_g'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:50: undefined reference to `H5Pcreate'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:55: undefined reference to `H5Pset_chunk_cache'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:59: undefined reference to `H5Dclose'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:61: undefined reference to `H5Dopen2'
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:64: undefined reference to `H5Pclose'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `NC4_rename_var':
/home/Angelica/tmp/netcdf-4.2.1.1/libsrc4/nc4var.c:1187: undefined reference to `H5Gmove'
...

and so on with the undefined references (H5 as well as curl) in the nc functions. Has anyone experienced this before and possibly have an idea of how I can fix it?

Thanks in advance.

-Angelica

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#52 Unread post by kate »

You have built the hdf5 library, now you need to include it in the link command. The preferred way to do that is through the nc-config --flibs command, which gives me:

Code: Select all

pacman3 10% nc-config --flibs
-L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdff -L/usr/local/pkg/hdf5/hdf5-1.8.10-p1.gnu-4.7.3/lib -L/usr/local/pkg/szip/szip-2.1.gnu/lib -L/usr/local/pkg/udunits/udunits-2.1.24.gnu-4.7.3/lib -L/usr/local/pkg/netcdf/netcdf-4.3.0.gnu-4.7.3/lib -lnetcdf -lnetcdf
Odd that it doesn't have an -lhdf5, but it works on our system. Anyway, you should set USE_NETCDF4 for the build, which invokes nc-config in the bit of makefile from the Compilers directory.

bferre
Posts: 2
Joined: Wed Jun 25, 2014 5:58 pm
Location: CAGE - UiT

Re: Netcdf downloading via Cygwin

#53 Unread post by bferre »

Hello
I am replying to this post because I have a lot of similarities to the previous messages. I succesfully installed netcdf-4.3.2 and netcdf-fortran-4.2, but oceanS.exe failed. I tried several tricks following numerous advices but cannot manage to build ROMS.
Via Cygwin, I installed:
gcc-core
gcc-fortran
bison
doxygen
curl
libcurl-devel
make
udunits
hdf5
libhdf5-devel
libhdf5_8

Here is what I have:
/usr/bin/gfortran -frepack-arrays -O3 -ffast-math /home/bfe000/roms/Projects/Upwelling/Build/ocean_control.o /home/bfe000/roms/Projects/Upwelling/Build/esmf_roms.o /home/bfe000/roms/Projects/Upwelling/Build/ocean_coupler.o /home/bfe000/roms/Projects/Upwelling/Build/roms_export.o /home/bfe000/roms/Projects/Upwelling/Build/master.o /home/bfe000/roms/Projects/Upwelling/Build/propagator.o /home/bfe000/roms/Projects/Upwelling/Build/roms_import.o -o /home/bfe000/roms/Projects/Upwelling/oceanS.exe /home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM_bio.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM_sed.a /home/bfe000/roms/Projects/Upwelling/Build/libANA.a /home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a /home/bfe000/roms/Projects/Upwelling/Build/libMODS.a -L/usr/local/lib -lnetcdff -lnetcdf
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `nc_def_var_nc4':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:430: undefined reference to `H5Tget_native_type'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:430:(.text+0x813): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Tget_native_type'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:514: undefined reference to `H5Dclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:514:(.text+0xb71): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Dclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:519: undefined reference to `H5Gunlink'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:519:(.text+0xb96): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Gunlink'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:444: undefined reference to `H5Tget_class'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:444:(.text+0xbb0): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Tget_class'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `nc4_reopen_dataset':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:50: undefined reference to `H5open'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:50:(.text+0x1011): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5open'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:50: undefined reference to `H5Pcreate'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:50:(.text+0x101f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Pcreate'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:55: undefined reference to `H5Pset_chunk_cache'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:55:(.text+0x1045): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Pset_chunk_cache'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:59: undefined reference to `H5Dclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:59:(.text+0x1051): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Dclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:61: undefined reference to `H5Dopen2'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:61:(.text+0x1064): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Dopen2'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:64: undefined reference to `H5Pclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:64:(.text+0x1072): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `H5Pclose'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o): In function `NC4_rename_var':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:1212: undefined reference to `H5Gmove'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4var.c:1212:(.text+0x1ee5): additional relocation overflows omitted from the output
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4var.o):nc4var.c:(.rdata$.refptr.H5P_CLS_DATASET_ACCESS_g[.refptr.H5P_CLS_DATASET_ACCESS_g]+0x0): undefined reference to `H5P_CLS_DATASET_ACCESS_g'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `sync_netcdf4_file':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:2869: undefined reference to `H5Fflush'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `close_netcdf4_file':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:2953: undefined reference to `H5Fclose'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:2957: undefined reference to `H5Fget_obj_count'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `dimscale_visitor':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:659: undefined reference to `H5Gget_objinfo'
/usr/local/lib/libnetcdf.a(libnetcdf4_la-nc4file.o): In function `get_netcdf_type':
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:681: undefined reference to `H5Tget_class'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:688: undefined reference to `H5Tis_variable_str'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:700: undefined reference to `H5open'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:700: undefined reference to `H5Tequal'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:707: undefined reference to `H5open'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:707: undefined reference to `H5Tequal'
/home/bfe000/software/netcdf-4.3.2/libsrc4/nc4file.c:714: undefined reference to `H5open'



And so on with other functions.
If I activate NETCDF-4 in CYGWIN-gfortran, the failed compilation gives me:
make: /opt/gfortransoft/serial/netcdf4/bin/nc-config: Command not found
/usr/bin/gfortran -frepack-arrays -O3 -ffast-math /home/bfe000/roms/Projects/Upwelling/Build/ocean_control.o /home/bfe000/roms/Projects/Upwelling/Build/esmf_roms.o /home/bfe000/roms/Projects/Upwelling/Build/ocean_coupler.o /home/bfe000/roms/Projects/Upwelling/Build/roms_export.o /home/bfe000/roms/Projects/Upwelling/Build/master.o /home/bfe000/roms/Projects/Upwelling/Build/propagator.o /home/bfe000/roms/Projects/Upwelling/Build/roms_import.o -o /home/bfe000/roms/Projects/Upwelling/oceanS.exe /home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM_bio.a /home/bfe000/roms/Projects/Upwelling/Build/libNLM_sed.a /home/bfe000/roms/Projects/Upwelling/Build/libANA.a /home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a /home/bfe000/roms/Projects/Upwelling/Build/libMODS.a
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(close_io.o):close_io.f90:(.text+0x108c): undefined reference to `__netcdf_MOD_nf90_strerror'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(close_io.o):close_io.f90:(.text+0x108c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_strerror'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fwrite2d.o):nf_fwrite2d.f90:(.text+0x41f): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fwrite2d.o):nf_fwrite2d.f90:(.text+0x41f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fwrite3d.o):nf_fwrite3d.f90:(.text+0x4d8): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fwrite3d.o):nf_fwrite3d.f90:(.text+0x4d8): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2212): undefined reference to `__netcdf_MOD_nf90_get_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2212): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_get_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2e25): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2e25): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fread3d.o):nf_fread3d.f90:(.text+0x888): undefined reference to `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fread3d.o):nf_fread3d.f90:(.text+0x888): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fread2d.o):nf_fread2d.f90:(.text+0x863): undefined reference to `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(nf_fread2d.o):nf_fread2d.f90:(.text+0x863): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_dim.o):def_dim.f90:(.text+0x6b): undefined reference to `__netcdf_MOD_nf90_def_dim'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_dim.o):def_dim.f90:(.text+0x6b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_def_dim'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xee3f): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xee3f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xee9e): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xee9e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xeefd): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xeefd): additional relocation overflows omitted from the output
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xef5c): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xefbb): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_info.o):def_info.f90:(.text+0xf01a): more undefined references to `__netcdf_MOD_nf90_put_att_text' follow
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_var.o):def_var.f90:(.text+0x298): undefined reference to `__netcdf_MOD_nf90_def_var_manydims'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_var.o):def_var.f90:(.text+0x310): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_var.o):def_var.f90:(.text+0x36d): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_var.o):def_var.f90:(.text+0x3fc): undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/bfe000/roms/Projects/Upwelling/Build/libUTIL.a(def_var.o):def_var.f90:(.text+0x49f): undefined reference to `__netcdf_MOD_nf90_put_att_one_eightbytereal'


How can I fix this?
Thank you for your help!

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Netcdf downloading via Cygwin

#54 Unread post by kate »

make: /opt/gfortransoft/serial/netcdf4/bin/nc-config: Command not found
This is a problem. Make sure the build is pointing to the correct directory for nc-config.

bferre
Posts: 2
Joined: Wed Jun 25, 2014 5:58 pm
Location: CAGE - UiT

Re: Netcdf downloading via Cygwin

#55 Unread post by bferre »

Thank you so much for your quick answer, Kate. You were right, I also needed to change the directories for NC_CONFIG and NETCDF_INCDIR inside my build. ROMS is now running for the upwelling test case, I am crossing my fingers that the numbers will make sense!
Thank you again
Benedicte

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#56 Unread post by m.hadfield »

Good :D , but you shouldn't need to define NETCDF_INCDIR if NC_CONFIG is set correctly.

csherwood
Posts: 39
Joined: Fri Apr 02, 2004 4:46 pm
Location: USGS, Woods Hole, USA

Re: Netcdf downloading via Cygwin

#57 Unread post by csherwood »

Hi Mark and Bene,

Unless things have changed, the NC_CONFIG macro is not very smart, and doesn't actually search for installed versions of NetCDF...it just assumes the netCDF files are in the location associated with the NC_CONFIG macro. Thus, if you have multiple netCDF installations, or have just copied binary versions, or moved the files, the macro won't work correctly.

-Chris
Chris Sherwood, USGS
1 508 457 2269

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#58 Unread post by m.hadfield »

csherwood wrote:Hi Mark and Bene,

Unless things have changed, the NC_CONFIG macro is not very smart, and doesn't actually search for installed versions of NetCDF...it just assumes the netCDF files are in the location associated with the NC_CONFIG macro. Thus, if you have multiple netCDF installations, or have just copied binary versions, or moved the files, the macro won't work correctly.

-Chris
The best way to handle multiple netCDF installations is to set the NC_CONFIG environment variable to the nc-config/nf-config script associated with the netCDF installation you want to use. If you've moved the files this might not work, but you can of course create a customised copy of the script for each installation pointing to whatever locations you want.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#59 Unread post by lalvarez »

Hello Kate & Mark

I have updated my computer and i´m istalling once again via cygwin, well while doing so, i have found that some of the utilities are obsolete such as:

gcc4, gcc4-core, gcc4-c++ andgcc4-fortran

Do You know which are the new ones that sustitute these old ones?

Thanks in advance

Leo

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#60 Unread post by m.hadfield »

I think the names you mention are commands (or maybe packages) that were needed during the transition from GCC 3.x to GCC 4.x, to select version 4 instead of version 3. GCC 4.x is the default now.

If you install Cygwin and ensure the following packages are selected (they are currently at version 4.9.2-3)
  • gcc-core
  • gcc-fortran
then you should have the compilers you need to build netCDF and ROMS. There are a few other utilities that you need and that may or may not be installed by default. I can think of make, perl and bison. I'm afraid you will have to determine the rest the way I do when I do a fresh install of Cygwin, i.e. trial and error.

lalvarez
Posts: 104
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Netcdf downloading via Cygwin

#61 Unread post by lalvarez »

Mark hello

In deed those packages only change their names from one version to another as you say,

from: gcc4, gcc4-core, gcc4-c++ and gcc4-fortran

to: gcc, gcc-core gcc-c++ and gcc-fortran

Those last ones are the ones i choose while installing cygwin and all the other you told me at the begining of this talk, i have already install succsesfully the netcdf c & fortran parts.

Thanks in advance

victoria.mcgruer
Posts: 2
Joined: Mon Oct 24, 2016 8:52 pm
Location: Okinawa Institute of Science and Technology

Re: Netcdf downloading via Cygwin

#62 Unread post by victoria.mcgruer »

Hello,
I am new to ROMS and have been trying to get the Upwelling test to run for the past week or so, thanks to the previous posts here I have gotten as far as I currently am but I am getting stuck running the build.bash to create the oceanS.exe.

I am working on a windows 7 machine via Cygwin 2.6.0 and have installed the following Cygwin packages: Gcc, Gcc-core, Gcc-c++, Gcc-fortran, Bison, Doxygen, Curl, Libcurl-devel, Make, Udunits, Hdf5, Libhdf5-devel

I have also installed the latest releases of netCDF-C and netCDF-Fortran via the instructions posted early on in this thread by m.hadfield: netCDF-C 4.4.1,
netCDF-Fortran 4.4.4


I am running into problems when I run the ./build.bash for the upwelling test case. The errors start in the output pasted below and continue on with a list of "undefined reference to..." Additionally I have pasted the outputs from "$nc-config --all" and "$nf-config --all" below.

I have noticed from previous posts in this thread the nc-config reads --has-f90 -> yes , by comparison my readout is --has-f90 -> no. I have tried configuring netcdf with a --disable-f03 command to try to force the use of f90. I have also tried manually changing the nc-config so that --has-f90 --> yes (as suggested byhttp://www.unidata.ucar.edu/support/hel ... 13147.html), however neither of these steps changed the error I have been receiving.

Could it possibly be the versions of netcdf I am using? Should I try an older version? or a different compiler? I have also tried running the upwelling test on ubuntu, however had more difficulty linking the netcdf libraries and switched back over to cygwin.

Any suggestions would be great I am very stuck..., thank you for your help!

The error I have been receiving when running the build.bash


/usr/bin/gfortran -frepack-arrays -O3 -ffast-math /home/arilab-common/roms/projects/upwelling/Build/ocean_control.o /home/arilab-common/roms/projects/upwelling/Build/esmf_roms.o /home/arilab-common/roms/projects/upwelling/Build/ocean_coupler.o /home/arilab-common/roms/projects/upwelling/Build/roms_export.o /home/arilab-common/roms/projects/upwelling/Build/master.o /home/arilab-common/roms/projects/upwelling/Build/propagator.o /home/arilab-common/roms/projects/upwelling/Build/roms_import.o -o /home/arilab-common/roms/projects/upwelling/oceanS.exe /home/arilab-common/roms/projects/upwelling/Build/libUTIL.a /home/arilab-common/roms/projects/upwelling/Build/libNLM.a /home/arilab-common/roms/projects/upwelling/Build/libNLM_bio.a /home/arilab-common/roms/projects/upwelling/Build/libNLM_sed.a /home/arilab-common/roms/projects/upwelling/Build/libANA.a /home/arilab-common/roms/projects/upwelling/Build/libUTIL.a /home/arilab-common/roms/projects/upwelling/Build/libMODS.a -L/usr/local/lib -lnetcdf
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(close_io.o):close_io.f90:(.text+0x108f): undefined reference to `__netcdf_MOD_nf90_strerror'
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(close_io.o):close_io.f90:(.text+0x108f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_strerror'
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(nf_fwrite3d.o):nf_fwrite3d.f90:(.text+0x58c): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(nf_fwrite3d.o):nf_fwrite3d.f90:(.text+0x58c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(nf_fwrite2d.o):nf_fwrite2d.f90:(.text+0x4a1): undefined reference to `__netcdf_MOD_nf90_put_var_1d_eightbytereal'
/home/arilab-common/roms/projects/upwelling/Build/libUTIL.a(nf_fwrite2d.o):nf_fwrite2d.f90:(.text+0x4a1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__netcdf_MOD_nf90_put_var_1d_eightbytereal'


Additionally, here is my output for “nc-config –all” and nf-config –all” :

$ nc-config --all

This netCDF 4.4.1 has been built with the following features:

--cc -> gcc
--cflags -> -I/usr/local/include
--libs ->

--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->

--fc -> gfortran
--fflags -> -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz -lcurl
--has-f90 -> no
--has-f03 -> yes

--has-dap -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging-> no
--has-pnetcdf-> no
--has-szlib ->

--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF 4.4.1



$ nf-config --all

This netCDF-Fortran 4.4.4 has been built with the following features:

--cc -> gcc
--cflags -> -I/usr/local/include -I/usr/local/include

--fc -> gfortran
--fflags -> -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lz -lcurl
--has-f90 -> no
--has-f03 -> yes

--has-nc2 -> yes
--has-nc4 -> yes

--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF-Fortran 4.4.4

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

Re: Netcdf downloading via Cygwin

#63 Unread post by jcwarner »

I see you went through a lot of effort to build netcdf. so i dont want to send you astray, but I wanted ot make sure you knew that you can download pre-built netcdf in the cygwin environment, as well as the gcc/gfortran compiler, as well as the openmpi utilities so that you can just build roms and run it in mpi with everything in cygwin. you dont need to build anything.

You might need to add -lnetcdff (notice 2 f's)
make sure you used the same flags to build roms as you did to build netcdf.
you can use the 'nm' command to look at the namelist in the netcdf.lib file and see if it has the missing var.

nm /cygdrive/c/cygwin64/lib/libnetcdff.dll.a > foo

0000000000000000 T __netcdf_MOD_nf90_strerror

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Netcdf downloading via Cygwin

#64 Unread post by m.hadfield »

I second John's suggestion. Don't build netCDF on Cygwin yourself; use the Cygwin packages.

Also, don't try adding extra command-line switches like -lnetcdff; make sure build.bash sets USE_NETCDF4 and let nc-config sort it out.

victoria.mcgruer
Posts: 2
Joined: Mon Oct 24, 2016 8:52 pm
Location: Okinawa Institute of Science and Technology

Re: Netcdf downloading via Cygwin

#65 Unread post by victoria.mcgruer »

Thank you both for your help! Uncommenting the USE_NETCDF4 line let the build.bash run to completion... Now onto visualization

Post Reply