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

From: Katharine Mullen <>
Date: Wed, 23 Jan 2008 02:31:57 +0100 (CET)

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.

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)


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 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: *** [] 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]]
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 23 Jan 2008 - 01:34:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jan 2008 - 09:30:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive