[R] install ncdf package

Sharpie chuck at sharpsteen.net
Wed Mar 24 19:26:22 CET 2010



Pinto wrote:
> 
> Dear R users 
> 
>  I am attempting to add  lncdf_1.6.tar.gz libraries within R, and have
> failed. I have R version 2.8.1, and are running on fedora 10 Kernel Linux
> 2.6.293.-60.fc10.x86_64.
> I've run R CMD INSTALL ncdf_1.6.tar.gz
> and I have the following 
> ---------------
> * Installing to library '/usr/lib64/R/library'
> * Installing *source* package 'ncdf' ...
> checking for gcc... gcc -m64 -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 -m64 -std=gnu99 accepts -g... yes
> checking for gcc -m64 -std=gnu99 option to accept ANSI C... none needed
> checking how to run the C preprocessor... gcc -m64 -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 -m64 -std=gnu99 -I/usr/include/R -I. -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 -I. -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
> 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
> ncdf3.c:249: warning: ‘rv_data’ may be used uninitialized in this function
> gcc -m64 -std=gnu99 -I/usr/include/R -I. -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
> ncdf.c: In function ‘R_nc_get_vara_double’:
> ncdf.c:196: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> ncdf.c:202: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> ncdf.c: In function ‘R_nc_get_vara_int’:
> ncdf.c:239: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> ncdf.c:245: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> ncdf.c: In function ‘R_nc_get_vara_text’:
> ncdf.c:296: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> ncdf.c:302: warning: format ‘%u’ expects type ‘unsigned int’, but argument
> 3 has type ‘size_t’
> 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’
> ncdf.c: In function ‘R_nc_put_vara_double’:
> ncdf.c:582: warning: format ‘%d’ expects type ‘int’, but argument 3 has
> type ‘size_t’
> ncdf.c:585: warning: format ‘%d’ expects type ‘int’, but argument 3 has
> type ‘size_t’
> gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o ncdf.so ncdf2.o ncdf3.o
> ncdf.o -L. -lnetcdf  -L/usr/lib64/R/lib -lR
> /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 `/usr/lib64/R/library/ncdf/libs/*': No such file or
> directory
> ERROR: compilation failed for package 'ncdf'
> ** Removing '/usr/lib64/R/library/ncdf'
> ---------------
> 
> Any help is strongly appreciated,
> thank you in advance
> 

Based on the error:

/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

I would guess that R is complaining about libnetcdf.a was not compiled to
use position independent code, hence the request for -fPIC.  However, my
expertise in these areas is amateur at best-- someone else may be able to
provide a more informed opinion.

Also, you stated you are using R 2.8.1 which is out of date by two, soon to
be three, major releases.  It is highly recommended to keep your version of
R as current as possible.  A newer version of R may contain changes to
package compilation that addresses the issues you are having- especially as
you are compiling for a 64 bit platform.

Good luck!

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/install-ncdf-package-tp1680818p1684264.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list