[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #TBJ-718809]: problems to install netCDF 4.2 in Ubuntu 10.04

Hi Elena,

> I have now spent a good 16 working hours trying to install netCDF 4.2 in
> Ubuntu 10.04. I am a biologist, new to Ubuntu and my programming skills are
> nil. I have browsed what it feels like thousands of websites and most of
> the time I have trouble to follow the instructions.
> My problem started in R. I tried to install the package "ncdf4" and got an
> error message saying
> Error, nc-config not found or not executable.  This is a script that
> comes with the
> netcdf library, version 4.1-beta2 or later, and must be present for
> configuration
> to succeed.
> Fair enough, but it happens that according to the Ubuntu Software
> Centre I already had lots of netcdf  and hdf5 files installed. If they
> are in the wrong place and thus R cannot read them, I don't know. I
> have no clue where the applications are kept. If I make a search for
> them I get folders with the same name in several places, so it seems
> impossible to me to track where R is looking for netcdf.

Before starting R, you should set your PATH environment variable to include
a bin directory that includes the ncdump, ncgen, and nc-config commands.
And you should export that PATH so that R can use it.  For example, if you
are using a shell like bash or ksh and nc-config is in /usr/local/bin, then
you need to do something like this:

  export PATH
     ... start R ...

If you're using a different shell, such as csh, the syntax for setting PATH is
different (setenv PATH /usr/local/bin:$PATH ), but the result is the same.

> Anyway, I tried to start from scratch and with the info gathered in a
> number of websites I think I managed to install HDF5, although I found
> rather confusing the command
> $ ./configure --prefix=/usr/local/hdf5 <more configure_flags>
> eventually I settled for
> ./configure --prefix=/usr/local/hdf5 --enable - shared --enable-hl

Note that you needed to use "--enable-shared", not "--enable - shared".  I asume
that was just a typo.

> Not sure what it means but I finished the installation without errors,
> and I assume the package is somewhere and other packages will be able
> to find it.
> I repeated the process with netCDF:
> 1) download from your website
> 2) moved it to /home/elena/ (just because it felt wrong to leave it on the 
> desk)
> 3) went to the terminal and did:
> cd /home/elena/
> tar -xvzf netcdf-4.2.0.tar.gz
> cd netcdf-4.2
> Then problems started to arise. I tried several scripts for
> ./configure, neither of which gave error, but nevertheless when I run
> $. sudo make check install I did get errors. The options I tried were:
> ./configure --enable-netcdf-4 --enable-large-file-tests
> --enable-ncgen4 --with-hdf5=/usr/local --with-zlib=/usr/local
> --prefix=/usr/local/

For versions 4.2 and later, the "--with-hdf5=..." configure option is no longer
supported.  Instead, you have to set CPPFLAGS and LDFLAGS, as explained here:


and then you don't need any of the "--enable" options above.  Also the 
--prefix=/usr/local" is the default, so you can omit that also.  So you could
just use:

  CPPFLAGS=-I/usr/local/hdf5/include LDFLAGS=-L/usr/local/hdf5/lib ./configure 

> When I run $. sudo make check install I got lots of gibberish ending with
> tst_h_dimscales4.c: In function âmainâ:
> tst_h_dimscales4.c:115: error: âH5F_LIBVER_18â undeclared (first use
> in this function)
> tst_h_dimscales4.c:115: error: (Each undeclared identifier is reported only 
> once
> tst_h_dimscales4.c:115: error: for each function it appears in.)
> make[2]: *** [tst_h_dimscales4.o] Error 1
> make[2]: Leaving directory `/home/elena/netcdf-4.2/h5_test'
> make[1]: *** [check-am] Error 2
> make[1]: Leaving directory `/home/elena/netcdf-4.2/h5_test'
> make: *** [check-recursive] Error 1

Yes, that's because the "--with-hdf5" configure option is no longer supported, 
the HDF5 library you successfully installed couldn't be found.  Using the 
and LDFLAGS as in the above configure example will solve that problem.

> Same thing happened with
> LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure
> --enable-netcdf-4 --enable-dap --enable-shared --prefix=/usr/local

That's because the hdf5 include files and libraries are in 
/usr/local/hdf5/include and 
/usr/local/hdf5/lib, not /usr/local/include and /usr/local/lib.

> And with
> CPPFLAGS=-I/home/elena/local/include LDFLAGS=-L/home/elena/local/lib
> ./configure --prefix=/home/elena/local
> I cannot stress enough how thankful I will be if you can provide a
> solution (ehem, asap), because I am really stuck and cannot go on with
> my work in R until I solve this... not to talk about the splitting
> headache and frustration accumulated over the past hours. By the way,
> I know that there is a new version of Ubuntu, but I prefer to wait for
> a few months to give smarter people the chance to fix all bugs before
> I update mine ;-)

I hope the above makes this installation work for you!


Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu

Ticket Details
Ticket ID: TBJ-718809
Department: Support netCDF
Priority: Normal
Status: Closed

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.