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

[netCDF #ESN-802630]: Problems installing netCDF



Christian,

> thank you very much for your detailed answer!
> 
> We decided to use the manual installation process.
> 
> netCDF installs very smoothly, only netCDF Fortran makes some trouble...
> 
> cd /opt/DRIHM/src
> wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.1.1.tar.gz
> tar xvfz netcdf-4.2.1.1.tar.gz
> 
> cd netcdf-4.2.1.1
> ./configure --prefix=/opt/DRIHM/libraries --disable-netcdf-4
> make check install
> 
> cd /opt/DRIHM/src
> wget 
> http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-fortran-4.2.tar.gz
> tar xvfz netcdf-fortran-4.2.tar.gz
> 
> cd netcdf-fortran-4.2
> 
> export LD_LIBRARY_PATH=/opt/DRIHM/libraries:$LD_LIBRARY_PATH

According to the installation location you specified with the --prefix option, 
the
netCDF C library was actually installed in  /opt/DRIHM/libraries/lib, so that's
what you would need for LD_LIBRARY_PATH.

> CPPFLAGS="-I/opt/DRIHM/libraries/include" ./configure 
> --prefix=/opt/DRIHM/libraries

Setting LD_LIBRARY_PATH is not sufficient to specify where the netCDF C
library is installed for configure.  You need to set LDFLAGS (and maybe even 
LDLIBS) to specify the directory and library name, as in:

  CPPFLAGS="-I/opt/DRIHM/libraries/include" LDFLAGS=-L/opt/DRIHM/libraries/lib 
LDLIBS=-lnetcdf ./configure --prefix=/opt/DRIHM/libraries 

You may find just LDFLAGS without LDLIBS is sufficient.

It looks like the documentation for building the Fortran library is wrong about
what goes in LDFLAGS versus what should be in LDLIBS.  I'll fix that after some
testing ...

--Russ

> make check
> make install
> 
> -> it does not find the netcdf-library. Do I have to set some special 
> parameters? (Details see attached).
> 
> Thank you very much!
> 
> Cheers
> Christian
> 
> 
> 
> 
> 
> Am 17.01.2013 um 23:46 schrieb Unidata netCDF Support <address@hidden>:
> 
> > Hi Christian,
> >
> >> I'm working in the DRIHM project (www.drihm.eu), where we need netCDF
> >> for several tools.
> >>
> >> Unfortunately, none of the regular installation types works:
> >>
> >> 1) using a package manager
> >> apt-get install libnetcdf6 netcdf-bin netcdf-dbg netcdf-doc
> >> Installs netCDF, but some files, for instance "netcdf.inc", are missing.
> >> Those files are necessary for our tools
> >
> > "netcdf.inc" is part of the netcdf-fortran release, which is a separate and
> > distinct release from the netCDF C software release.  If you are building 
> > from
> > source, you would first get, build, and install the netCDF C release, then 
> > if
> > you also needed the netCDF Fortran library, you would get that source 
> > distribution
> > (which depends on the C netCDF library), configure it to specify where the 
> > netCDF
> > C library is installed, and build and install it.
> >
> > The instructions for this two-step process are here:
> >
> >  http://www.unidata.ucar.edu/netcdf/docs/
> >  http://www.unidata.ucar.edu/netcdf/docs/building.html
> >  http://www.unidata.ucar.edu/netcdf/docs/netcdf-fortran-install.html
> >
> > Some of the package managers that offer the latest netCDF software
> > release for C libraries also offer a separate netcdf-fortran release
> > for the Fortran libraries.
> >
> >> 2) manual installation
> >> cd /usr/local
> >> wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.2.1.1.tar.gz
> >> tar xfvz netcdf-4.2.1.1.tar.gz
> >> mv netcdf-4.2.1.1 netcdf
> >> cd netcdf
> >> ./configure --prefix=/usr/local/netcdf --disable-netcdf-4
> >> make check install
> >>
> >> A lot of tests pass, but three tests do not pass:
> >> make[2]: *** [install-includeHEADERS] Error 1
> >> make[2]: Leaving directory `/usr/local/netcdf/include'
> >> make[1]: *** [install-am] Error 2
> >> make[1]: Leaving directory `/usr/local/netcdf/include'
> >> make: *** [install-recursive] Error 1
> >>
> >> Is that a problem? "Error 1" is not a very verbose output...
> >
> > This problem may be a symptom of specifying the installation prefix
> > (/usr/local/netcdf) to the same directory where you are trying to
> > build and test the netcdf software.  Those have to be separate
> > directories, although the installation documentation doesn't make
> > that clear.  If they are the same, source files get overwritten by
> > installed files, and you get inscrutable error messages from make, such
> > as the above.
> >
> > Thanks for pointing out this problem.  We need to add a test that prevents
> > using the source directory as the installation directory.  I've made this
> > a Jira ticket, in case you want to follow progress on the fix for the 
> > problem:
> >
> >  https://www.unidata.ucar.edu/jira/browse/NCF-215
> >
> >> Additionally, I want to install netCDF Fortran libraries. In the
> >> documentation, there is this sentence: "to link Fortran software with the
> >> installed Fortran library, You could also use the "nf-config" utility
> >> installed in {DIR1}/bin." but this binary is not located in the bin
> >> directory. Instead, it is located in /usr/local/netcdf?!
> >
> > That sounds like another symptom of specifying the installation location
> > as the same directory in which the source for building the libraries is
> > located.  Also, "nf-config" is part of the netcdf-fortran software, so
> > would not be installed by the netCDF C release.
> >
> >> So how can I install the netCDF libraries to work with them?
> >
> > It sounds like it would be best to build from source if the package 
> > management
> > system you are using hasn't been updated to recognize that the C and Fortran
> > distributions are separate software releases.  I hope the URLs above can 
> > help
> > make it clear how to build and install the software from source.
> >
> > --Russ
> >
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: ESN-802630
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> 
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: ESN-802630
Department: Support netCDF
Priority: Normal
Status: Closed