[R] install error - Netcdf library (linux)

David W. Pierce dpierce at ucsd.edu
Fri Mar 8 01:27:27 CET 2013


> Hi All,
>
> i'm on a debian linux 64bit,
> i'm tying to install the netcdf intraface, i tried both ncdf and ncdf4

[error lines cut]

Hi Massimo,

things are getting confused because nc-config thinks that the netcdf
library is installed in one place, and you are telling R that it's
installed in a different place:

Your command line specifies /usr/lib and /usr/include:

> epy at epinux:~$ sudo R CMD INSTALL --configure-args="-with-
netcdf_incdir=/usr/include -with-netcdf_libdir=/usr/lib"

But nc-config thinks it's in /usr/local:

> --cflags    ->  -I/usr/local/include -I/usr/local/include
> --libs      -> -L/usr/local/lib -lnetcdf

Is there a reason you specified the paths on the command line? I
suggest *not* specifying the paths in the command line and seeing if
it works automatically using the information in nc-config. However, if
the information in nc-config is outright wrong (for instance, if the
libraries were moved manually after the library was installed), I
suggest removing your current installation of the netcdf library and
re-installing it cleanly from scratch so that it has a correct and
working nc-config.

Regards,

--Dave


On Thu, Mar 7, 2013 at 3:45 PM, epi <massimodisasha at gmail.com> wrote:
> Hi All,
>
> i'm on a debian linux 64bit,
> i'm tying to install the netcdf intraface, i tried both ncdf and ncdf4
>
> but  trying to build i received the error :
>
> (i have necdf installed on my machine and it is able to fiund it .. no missed .h)
>
> epy at epinux:~$ sudo R CMD INSTALL --configure-args="-with-netcdf_incdir=/usr/include -with-netcdf_libdir=/usr/lib" ncdf4_1.8.tar.gz
> * installing to library ‘/usr/local/lib/R/site-library’
> * installing *source* package ‘ncdf4’ ...
> checking for nc-config... yes
> Using nc-config: nc-config
> Output of nc-config --all:
>
> This netCDF 4.2.1.1 has been built with the following features:
>
>  --cc        -> gcc
>  --cflags    ->  -I/usr/local/include -I/usr/local/include
>  --libs      -> -L/usr/local/lib -lnetcdf
>
>  --has-c++   -> no
>  --cxx       ->
>  --has-c++4  -> no
>  --cxx4      ->
>
>  --fc        ->
>  --fflags    ->
>  --flibs     ->
>  --has-f90   -> no
>
>  --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
>
> ---
> 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.1.1
> 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 -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 -I/usr/local/include     -fpic  -O2 -pipe -g  -c ncdf.c -o ncdf.o
> ncdf.c: In function ‘R_nc4_nctype_to_Rtypecode’:
> ncdf.c:40:18: error: ‘NC_INT’ undeclared (first use in this function)
> ncdf.c:40:18: note: each undeclared identifier is reported only once for each function it appears in
> ncdf.c:49:18: error: ‘NC_UBYTE’ undeclared (first use in this function)
> ncdf.c:51:18: error: ‘NC_USHORT’ undeclared (first use in this function)
> ncdf.c:53:18: error: ‘NC_UINT’ undeclared (first use in this function)
> ncdf.c:55:18: error: ‘NC_INT64’ undeclared (first use in this function)
> ncdf.c:57:18: error: ‘NC_UINT64’ undeclared (first use in this function)
> ncdf.c: In function ‘R_nc4_varsize’:
> ncdf.c:69:28: error: ‘NC_MAX_DIMS’ undeclared (first use in this function)
> ncdf.c:75:2: warning: implicit declaration of function ‘nc_inq_varndims’ [-Wimplicit-function-declaration]
> ncdf.c:78:4: warning: implicit declaration of function ‘nc_strerror’ [-Wimplicit-function-declaration]
> ncdf.c:84:2: warning: implicit declaration of function ‘nc_inq_vardimid’ [-Wimplicit-function-declaration]
> ncdf.c:94:3: warning: implicit declaration of function ‘nc_inq_dimlen’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_varunlim’:
> ncdf.c:112:2: warning: implicit declaration of function ‘nc_inq_unlimdim’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_var’:
> ncdf.c:152:2: warning: implicit declaration of function ‘nc_inq_var’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_vartype’:
> ncdf.c:168:2: warning: implicit declaration of function ‘nc_inq_vartype’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_varname’:
> ncdf.c:181:2: warning: implicit declaration of function ‘nc_inq_varname’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_vara_double’:
> ncdf.c:214:2: warning: implicit declaration of function ‘nc_get_vara_double’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_vara_int’:
> ncdf.c:257:2: warning: implicit declaration of function ‘nc_get_vara_int’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_vara_text’:
> ncdf.c:313:2: warning: implicit declaration of function ‘nc_get_vara_text’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_dimid’:
> ncdf.c:345:2: warning: implicit declaration of function ‘nc_inq_dimid’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_varid’:
> ncdf.c:355:2: warning: implicit declaration of function ‘nc_inq_varid’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_dimids’:
> ncdf.c:377:9: warning: implicit declaration of function ‘nc_inq_dimids’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_dim’:
> ncdf.c:387:12: error: ‘NC_MAX_NAME’ undeclared (first use in this function)
> ncdf.c:391:2: warning: implicit declaration of function ‘nc_inq_dim’ [-Wimplicit-function-declaration]
> ncdf.c:408:2: warning: implicit declaration of function ‘nc_inq_unlimdims’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq’:
> ncdf.c:451:2: warning: implicit declaration of function ‘nc_inq’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_open’:
> ncdf.c:475:2: warning: implicit declaration of function ‘nc_open’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_create’:
> ncdf.c:499:15: error: ‘NC_SHARE’ undeclared (first use in this function)
> ncdf.c:501:15: error: ‘NC_64BIT_OFFSET’ undeclared (first use in this function)
> ncdf.c:503:15: error: ‘NC_NETCDF4’ undeclared (first use in this function)
> ncdf.c:505:2: warning: implicit declaration of function ‘nc_create’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_ttc_to_nctype’:
> ncdf.c:518:11: error: ‘NC_INT’ undeclared (first use in this function)
> ncdf.c: In function ‘R_nc4_put_att_logical’:
> ncdf.c:554:4: warning: implicit declaration of function ‘nc_put_att_float’ [-Wimplicit-function-declaration]
> ncdf.c:564:4: warning: implicit declaration of function ‘nc_put_att_double’ [-Wimplicit-function-declaration]
> ncdf.c:579:3: warning: implicit declaration of function ‘nc_put_att_int’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_att_text’:
> ncdf.c:633:2: warning: implicit declaration of function ‘nc_put_att_text’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_att_int’:
> ncdf.c:645:2: warning: implicit declaration of function ‘nc_get_att_int’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_att_double’:
> ncdf.c:653:2: warning: implicit declaration of function ‘nc_get_att_double’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_att’:
> ncdf.c:669:2: warning: implicit declaration of function ‘nc_inq_att’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_get_att_text’:
> ncdf.c:698:2: warning: implicit declaration of function ‘nc_get_att_text’ [-Wimplicit-function-declaration]
> ncdf.c:705:2: warning: implicit declaration of function ‘nc_inq_attlen’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_vara_double’:
> ncdf.c:753:2: warning: implicit declaration of function ‘nc_put_vara_double’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_vara_int’:
> ncdf.c:780:2: warning: implicit declaration of function ‘nc_put_vara_int’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_var_int’:
> ncdf.c:789:2: warning: implicit declaration of function ‘nc_put_var_int’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_var_double’:
> ncdf.c:798:2: warning: implicit declaration of function ‘nc_put_var_double’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_put_vara_text’:
> ncdf.c:835:3: warning: implicit declaration of function ‘nc_put_vara_text’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_def_var_byte’:
> ncdf.c:947:2: warning: implicit declaration of function ‘nc_def_var’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_def_var_int’:
> ncdf.c:964:3: error: ‘NC_INT’ undeclared (first use in this function)
> ncdf.c: In function ‘R_nc4_def_dim’:
> ncdf.c:1043:2: warning: implicit declaration of function ‘nc_def_dim’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_redef’:
> ncdf.c:1054:2: warning: implicit declaration of function ‘nc_redef’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_rename_var’:
> ncdf.c:1063:2: warning: implicit declaration of function ‘nc_rename_var’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_attname’:
> ncdf.c:1072:2: warning: implicit declaration of function ‘nc_inq_attname’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_def_var_chunking’:
> ncdf.c:1102:16: error: ‘NC_CONTIGUOUS’ undeclared (first use in this function)
> ncdf.c:1104:16: error: ‘NC_CHUNKED’ undeclared (first use in this function)
> ncdf.c:1116:2: warning: implicit declaration of function ‘nc_def_var_chunking’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_var_chunking’:
> ncdf.c:1139:2: warning: implicit declaration of function ‘nc_inq_var_chunking’ [-Wimplicit-function-declaration]
> ncdf.c:1145:20: error: ‘NC_CONTIGUOUS’ undeclared (first use in this function)
> ncdf.c:1147:25: error: ‘NC_CHUNKED’ undeclared (first use in this function)
> ncdf.c: In function ‘R_nc4_inq_var_deflate’:
> ncdf.c:1173:2: warning: implicit declaration of function ‘nc_inq_var_deflate’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_def_var_deflate’:
> ncdf.c:1212:2: warning: implicit declaration of function ‘nc_def_var_deflate’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_ngroups’:
> ncdf.c:1227:2: warning: implicit declaration of function ‘nc_inq_grps’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_grpname’:
> ncdf.c:1307:2: warning: implicit declaration of function ‘nc_inq_grpname_len’ [-Wimplicit-function-declaration]
> ncdf.c:1317:2: warning: implicit declaration of function ‘nc_inq_grpname’ [-Wimplicit-function-declaration]
> ncdf.c: In function ‘R_nc4_inq_format’:
> ncdf.c:1364:2: warning: implicit declaration of function ‘nc_inq_format’ [-Wimplicit-function-declaration]
> ncdf.c:1374:8: error: ‘NC_FORMAT_CLASSIC’ undeclared (first use in this function)
> ncdf.c:1378:8: error: ‘NC_FORMAT_64BIT’ undeclared (first use in this function)
> ncdf.c:1382:8: error: ‘NC_FORMAT_NETCDF4’ undeclared (first use in this function)
> ncdf.c:1386:8: error: ‘NC_FORMAT_NETCDF4_CLASSIC’ undeclared (first use in this function)
> make: *** [ncdf.o] Error 1
> ERROR: compilation failed for package ‘ncdf4’
> * removing ‘/usr/local/lib/R/site-library/ncdf4’
>
>
>
> Thanks for any help!
>
> Massimo.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpierce at ucsd.edu



More information about the R-help mailing list