Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I hope someone can provide an explanation in plain English for this problem. My questions are 1) why is this happening, 2) how can I solve it.

Trying to install in R a package called ncdf4 I got the following message:

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.

According to the Ubuntu Software Centre I already had lots of netcdf and hdf5 files installed, but nevertheless decided to install the latest versions from source according to the information in the install instructions of the packages and many websites.

I had lots of trouble with the ./configure command. I tried several options, 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/ 

which resulted in most checkings being yes, created lots of stuff and ended with:

config.status: executing depfiles commands

config.status: executing libtool commands
configure: WARNING: unrecognized options: --enable-ncgen4, --with-hdf5, --with-zlib

Then I ran sudo make check install, and 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

The 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

And with:

CPPFLAGS=-I/home/elena/local/include LDFLAGS=-L/home/elena/local/lib ./configure --prefix=/home/elena/local

Today, I let somebody very knowledgeable in linux to take a look and he said that zlib, netcdf and hdf5 are in the computer, in /usr/bin/, and that nf-config is in /usr/lib/.

But when we tried to install ncdf4 in R we got:

> install.packages("ncdf4")
Installing package(s) into ‘/home/elena/R/i486-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
trying URL 'http://www.stats.bris.ac.uk/R/src/contrib/ncdf4_1.6.1.tar.gz'
Content type 'application/x-gzip' length 98337 bytes (96 Kb)
opened URL
==================================================
downloaded 96 Kb

* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
checking for nc-config... no
-----------------------------------------------------------------------------------
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.

If you installed the netcdf library (and nc-config) in a standard location, nc-config
should be found automatically.  Otherwise, you can specify the full path and name of
the nc-config script by passing the --with-nc-config=/full/path/nc-config argument
flag to the configure script.  For example:

./configure --with-nc-config=/sw/dist/netcdf4/bin/nc-config

Special note for R users:
-------------------------
To pass the configure flag to R, use something like this:

R CMD INSTALL --configure-args="--with-nc-config=/home/joe/bin/nc-config" ncdf4

where you should replace /home/joe/bin etc. with the location where you have
installed the nc-config script that came with the netcdf 4 distribution.
-----------------------------------------------------------------------------------
ERROR: configuration failed for package ‘ncdf4’
* removing ‘/home/elena/R/i486-pc-linux-gnu-library/2.15/ncdf4’
Warning in install.packages :
  installation of package ‘ncdf4’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpycBThr/downloaded_packages’
> install.packages("ncdf4")
Installing package(s) into ‘/home/elena/R/i486-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
trying URL 'http://www.stats.bris.ac.uk/R/src/contrib/ncdf4_1.6.1.tar.gz'
Content type 'application/x-gzip' length 98337 bytes (96 Kb)
opened URL
==================================================
downloaded 96 Kb

* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
checking for nc-config... yes
Using nc-config: nc-config
Output of 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

  --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

---
netcdf.m4: about to set rpath, here is source string: >-L/usr/local/lib -lnetcdf<
netcdf.m4: final rpath:   -Wl,-rpath,/usr/local/lib
Netcdf library version: netCDF 4.2
Netcdf library has version 4 interface present: yes
Netcdf library was compiled with C compiler: gcc
configure: creating ./config.status
config.status: creating R/load.R
config.status: creating src/Makevars

**********************  Results of ncdf4 package configure *******************

netCDF v4 CPP flags     = -I/usr/local/include
netCDF v4 LD flags      =   -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lnetcdf
netCDF v4 runtime path  =   -Wl,-rpath,/usr/local/lib

******************************************************************************

** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include     -fpic  -O3 -pipe  -g  -c ncdf.c -o ncdf.o
ncdf.c: In function ‘R_nc4_nctype_to_Rtypecode’:
ncdf.c:49: error: ‘NC_UBYTE’ undeclared (first use in this function)
ncdf.c:49: error: (Each undeclared identifier is reported only once
ncdf.c:49: error: for each function it appears in.)
ncdf.c:51: error: ‘NC_USHORT’ undeclared (first use in this function)
ncdf.c:53: error: ‘NC_UINT’ undeclared (first use in this function)
ncdf.c:55: error: ‘NC_INT64’ undeclared (first use in this function)
ncdf.c:57: error: ‘NC_UINT64’ undeclared (first use in this function)
ncdf.c:59: error: ‘NC_STRING’ undeclared (first use in this function)
ncdf.c: In function ‘R_nc4_inq_dimids’:
ncdf.c:377: warning: implicit declaration of function ‘nc_inq_dimids’
ncdf.c: In function ‘R_nc4_inq_dim’:
ncdf.c:408: warning: implicit declaration of function ‘nc_inq_unlimdims’
ncdf.c: In function ‘R_nc4_create’:
ncdf.c:503: error: ‘NC_NETCDF4’ undeclared (first use in this function)
ncdf.c: In function ‘R_nc4_def_var_chunking’:
ncdf.c:1102: error: ‘NC_CONTIGUOUS’ undeclared (first use in this function)
ncdf.c:1104: error: ‘NC_CHUNKED’ undeclared (first use in this function)
ncdf.c:1116: warning: implicit declaration of function ‘nc_def_var_chunking’
ncdf.c: In function ‘R_nc4_inq_var_chunking’:
ncdf.c:1139: warning: implicit declaration of function ‘nc_inq_var_chunking’
ncdf.c:1145: error: ‘NC_CONTIGUOUS’ undeclared (first use in this function)
ncdf.c:1147: error: ‘NC_CHUNKED’ undeclared (first use in this function)
ncdf.c: In function ‘R_nc4_inq_var_deflate’:
ncdf.c:1173: warning: implicit declaration of function ‘nc_inq_var_deflate’
ncdf.c: In function ‘R_nc4_def_var_deflate’:
ncdf.c:1212: warning: implicit declaration of function ‘nc_def_var_deflate’
ncdf.c: In function ‘R_nc4_inq_ngroups’:
ncdf.c:1227: warning: implicit declaration of function ‘nc_inq_grps’
ncdf.c: In function ‘R_nc4_grpname’:
ncdf.c:1307: warning: implicit declaration of function ‘nc_inq_grpname_len’
ncdf.c:1317: warning: implicit declaration of function ‘nc_inq_grpname’
make: *** [ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf4’
* removing ‘/home/elena/R/i486-pc-linux-gnu-library/2.15/ncdf4’
Warning in install.packages :
  installation of package ‘ncdf4’ had non-zero exit status

Any ideas?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.