Minor Issues in Installing the NCDF Libary Package for R

It seemed a trivial request, and once you've realised a couple of minor issues it is; install the NCDF library, a common scientific data format, for R, the well-known statistics software.

There is a usual way to install a package in R. Simply load the program and run the install.packages function; but this didn't quite work.

checking for /sw/lib/libnetcdf.a... no
Fatal error: I cannot find the directory that holds the netcdf library file libnetcdf.a !

The install.packages function checks in all the wrong places for the install of netcdf, or at least wrong accordin to me, but does provides the useful error message:

*** Special note for R CMD INSTALL users: *********************************
The syntax for specifying multiple --configure-args does not seem to be
well documented in R. If you have installed the netcdf include and library
directories in some non-standard location, you can specify BOTH these
during the R CMD INSTALL process using the following syntax:

R CMD INSTALL --configure-args="-with-netcdf_incdir=/path/to/netcdf/incdir -with-netcdf_libdir=/path/to/netcdf/libdir" ncdf_1.1.tar.gz

where you should, of course, specify your own netcdf include and library
directories, and the actual package name.

So lets install it from the source instead:

wget http://cran.r-project.org/src/contrib/ncdf_1.6.3.tar.gz
module load netcdf
R CMD INSTALL --configure-args="-with-netcdf_incdir=/usr/local/netcdf/4.1.1-gcc/include -with-netcdf_libdir=/usr/local/netcdf/4.1.1-gcc/lib" ncdf_1.6.3.tar.gz

Getting closer, but now there's a different error

Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared library '/usr/local/R/2.11.1-gcc/lib64/R/library/ncdf/libs/ncdf.so':
/usr/local/R/2.11.1-gcc/lib64/R/library/ncdf/libs/ncdf.so: undefined symbol: curl_easy_getinfo
ERROR: loading failed

It seems that the ncdf doesn't like netcdf for any version above 4 (even if it has been explicitly disabled). So let's try an earlier version.

R CMD INSTALL --configure-args="-with-netcdf_incdir=/usr/local/netcdf/3.6.2-gcc/include -with-netcdf_libdir=/usr/local/netcdf/3.6.2-gcc/lib" ncdf_1.6.3.tar.gz

installing to /usr/local/R/2.11.1-gcc/lib64/R/library/ncdf/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (ncdf)