Skip to content

ncdf4 installation problem: undefined symbol [SEC=UNCLASSIFIED]

3 messages · David W. Pierce, Andrew Harley

#
Hello,
 
I'm trying to install ncdf4 on RHEL 5.8, R version 2.15.1.

Previously installed is netcdf 3.6.2 from Red Hat, so I've compiled and installed netcdf 4.2.1.1 (with hdf5 and zlib as per install instructions, and also set --enable-netcdf4 option) into /usr/local.

When attempting to install ncdf4 it is failing with:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib64/R/library/ncdf4/libs/ncdf4.so':
  /usr/lib64/R/library/ncdf4/libs/ncdf4.so: undefined symbol: nc_inq_var_deflate
Error: loading failed
Execution halted

I'm guessing I'm missing somewhere that I need to specify the path, but the configure script picks up version netcdf 4.2.1.1 and explicitly setting LD_LIBRARY_PATH to /usr/local/lib doesn't help either. Can anyone please help with where I should be looking? Full command output below:

$ R CMD INSTALL ncdf4_1.6.1.tar.gz 
* installing to library '/usr/lib64/R/library'
* 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.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   -> no
  --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 -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/local/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c ncdf.c -o ncdf.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/local/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c ncdf2.c -o ncdf2.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/local/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c ncdf3.c -o ncdf3.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/local/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c src_ncdf4.c -o src_ncdf4.o
gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o ncdf4.so ncdf.o ncdf2.o ncdf3.o src_ncdf4.o -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lnetcdf -L/usr/lib64/R/lib -lR
installing to /usr/lib64/R/library/ncdf4/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
  converting help for package 'ncdf4'
    finding HTML links ... done
    ancdf4                                  html  
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ancdf4.Rd:58: missing file link 'ncvar_put'
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ancdf4.Rd:76: missing file link 'ncvar_put'
    ancvar_put                              html  
    nc_close                                html  
    nc_create                               html  
    nc_enddef                               html  
    nc_open                                 html  
    nc_redef                                html  
    nc_sync                                 html  
    nc_version                              html  
    ncatt_get                               html  
    ncatt_put                               html  
    ncdf4-internal                          html  
    ncdim_def                               html  
    ncvar_add                               html  
    ncvar_change_missval                    html  
    ncvar_def                               html  
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_def.Rd:67: missing file link 'ncvar_put'
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_def.Rd:100: missing file link 'ncvar_put'
    ncvar_get                               html  
Rd warning: /tmp/RtmpSxjZ1u/R.INSTALL3e7b250a942e/ncdf4/man/ncvar_get.Rd:77: missing file link 'ncvar_put'
    ncvar_rename                            html  
    print.ncdf4                             html  
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib64/R/library/ncdf4/libs/ncdf4.so':
  /usr/lib64/R/library/ncdf4/libs/ncdf4.so: undefined symbol: nc_inq_var_deflate
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/usr/lib64/R/library/ncdf4'

Thanks,

Andrew Harley
Linux Systems Administrator
Climate and Water Division (ICT Operations)
Bureau of Meteorology, Australia
03 9616 8441
http://www.bom.gov.au/water/
#
On Mon, Feb 4, 2013 at 7:07 PM, Andrew Harley <A.Harley at bom.gov.au> wrote:
Hi Andrew,

I think it's reasonably likely that some components of the old netcdf
library installation are being found by mistake. The compiler system
makes it easy to include library locations, but hard to exclude
library locations, so this kind of error is not uncommon. I suggest
first removing all  instances of the old libnetcdf and netcdf.h from
your machine, and then try again.

Regards,

--Dave

<rest of previous message is below>
--
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
#
Thanks Dave, I did a thorough check and made sure to remove any other traces of libnetcdf and I got it installed.

Cheers