[R] install ncdf package on a 64-bit machine

Katharine Mullen kate at few.vu.nl
Wed Jan 23 02:31:57 CET 2008


I am running 64-bit Ubuntu 7.10 and unfortunately remember seeing that 
error message but not how I got it to go away.

I would first try compiling netcdf-3.6.2 from source, without changing the 
default directories for installation.

Looking at the error message it seems like the 3 shared libraries get made 
but then linking them gives the error - that step seems to be where it 
says to compile with "-fPIC".

My output of install.packages("ncdf") is below with that of sessionInfo() 
- I still see a lot of warnings.

* Installing *source* package 'ncdf' ...
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking netcdf.h usability... yes
checking netcdf.h presence... yes
checking for netcdf.h... yes
Found netcdf.h in: .
checking for nc_open in -lnetcdf... yes
Found netcdf library file libnetcdf.a in directory .
configure: creating ./config.status
config.status: creating R/load.R
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/local/lib64/R/include -I/usr/local/lib64/R/include 
-I. -I/usr/local/include    -fpic  -g -O2 -c ncdf2.c -o ncdf2.o
gcc -std=gnu99 -I/usr/local/lib64/R/include -I/usr/local/lib64/R/include 
-I. -I/usr/local/include    -fpic  -g -O2 -c ncdf3.c -o ncdf3.o
ncdf3.c: In function R_nc_get_vara_charvarid:
ncdf3.c:221: warning: assignment discards qualifiers from pointer target 
type
ncdf3.c: In function R_nc_get_vara_numvarid:
ncdf3.c:267: warning: assignment discards qualifiers from pointer target 
type
gcc -std=gnu99 -I/usr/local/lib64/R/include -I/usr/local/lib64/R/include 
-I. -I/usr/local/include    -fpic  -g -O2 -c ncdf.c -o ncdf.o
ncdf.c: In function R_nc_ttc_to_nctype:
ncdf.c:424: warning: implicit declaration of function exit
ncdf.c:424: warning: incompatible implicit declaration of built-in 
function exit
gcc -std=gnu99 -shared -L/usr/local/lib64 -o ncdf.so ncdf2.o ncdf3.o 
ncdf.o -L. -lnetcdf
** R
** preparing package for lazy loading
** help
  >>> Building/Updating help pages for package 'ncdf'
      Formats: text html latex example
   ancdf                             text    html    latex
   aput.var.ncdf                     text    html    latex   example
Note: unmatched right brace in 'att.get.ncdf' on or after line 6
   att.get.ncdf                      text    html    latex   example
   att.put.ncdf                      text    html    latex   example
   close.ncdf                        text    html    latex   example
   create.ncdf                       text    html    latex   example
   dim.def.ncdf                      text    html    latex   example
   enddef.ncdf                       text    html    latex   example
   get.var.ncdf                      text    html    latex   example
   ncdf-internal                     text    html    latex
   open.ncdf                         text    html    latex   example
   print.ncdf                        text    html    latex   example
   redef.ncdf                        text    html    latex   example
   set.missval.ncdf                  text    html    latex   example
   sync.ncdf                         text    html    latex   example
   var.add.ncdf                      text    html    latex   example
   var.def.ncdf                      text    html    latex   example
Note: unmatched right brace in 'version.ncdf' on or after line 6
   version.ncdf                      text    html    latex
** building package indices ...
* DONE (ncdf)

The downloaded packages are in
         /tmp/RtmpcJ0Af9/downloaded_packages
Updating HTML index of packages in '.Library'
>

> sessionInfo()
R version 2.6.1 (2007-11-26)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
  [1] splines   grid      tcltk     stats     graphics  grDevices utils
  [8] datasets  methods   base

other attached packages:
  [1] ncdf_1.6         xtable_1.5-2     TIMP_1.5         minpack.lm_1.0-5
  [5] quadprog_1.4-11  nnls_1.2         gclus_1.2        gplots_2.3.2
  [9] gdata_2.3.1      gtools_2.4.0     fields_3.5       vcd_1.0-6
[13] colorspace_0.95  MASS_7.2-38

loaded via a namespace (and not attached):
[1] rcompgen_0.1-17 tools_2.6.1

On Tue, 22 Jan 2008, Linda Smith wrote:

> Dear All,
> I recently got a 64bit machine and had netcdf-3.6.2 installed. Then I tried
> to install ncdf package but got the following error message when using
> netcdflib:
>
> gcc -std=gnu99 -I/home/ljin/share/R-2.6.1/include
> -I/home/ljin/share/R-2.6.1/include
> -I. -I/usr/local/include    -fpic  -g -O2 -c ncdf2.c -o ncdf2.o
> gcc -std=gnu99 -I/home/ljin/share/R-2.6.1/include
> -I/home/ljin/share/R-2.6.1/include
> -I. -I/usr/local/include    -fpic  -g -O2 -c ncdf3.c -o ncdf3.o
> ncdf3.c: In function 'R_nc_get_vara_charvarid':
> ncdf3.c:221: warning: assignment discards qualifiers from pointer target
> type
> ncdf3.c: In function 'R_nc_get_vara_numvarid':
> ncdf3.c:267: warning: assignment discards qualifiers from pointer target
> type
> gcc -std=gnu99 -I/home/ljin/share/R-2.6.1/include
> -I/home/ljin/share/R-2.6.1/include
> -I. -I/usr/local/include    -fpic  -g -O2 -c ncdf.c -o ncdf.o
> ncdf.c: In function 'R_nc_ttc_to_nctype':
> ncdf.c:424: warning: implicit declaration of function 'exit'
> ncdf.c:424: warning: incompatible implicit declaration of built-in function
> 'exit'
> gcc -std=gnu99 -shared -L/usr/local/lib64 -o ncdf.so ncdf2.o ncdf3.o
> ncdf.o-L. -lnetcdf
> /usr/bin/ld: /usr/local/lib/libnetcdf.a(attr.o): relocation R_X86_64_32
> against `a local symbol' can not be used when making a shared object;
> recompile with -fPIC
> /usr/local/lib/libnetcdf.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [ncdf.so] Error 1
> chmod: cannot access `/home/ljin/share/R-2.6.1/library/ncdf/libs/*': No such
> file or directory
> ERROR: compilation failed for package 'ncdf'
> ** Removing '/home/ljin/share/R-2.6.1/library/ncdf'
>
> ========
> I had no problem when I install the ncdf package on my 32bit linux machine.
> Could anyone help me with the installation on 64bit machine?
>
> Thanks!
>
> Linda
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list