[R] ncdf installation

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Mar 10 09:40:56 CET 2010


To include code in a shared object on x86_64 Linux it must be compiled 
with -fPIC (or -fpic), as the error message said quite explicitly.

You seem only to have static netlib libraries: you need dynamic ones 
if you installed these from a binary package.  However, 
'/apps/netcdf/4.0.1/gcc/lib' suggests you installed this yourself from 
the sources, when you also have the option of re-building static libs 
with the appropriate flags.

On Tue, 9 Mar 2010, Bala subramanian wrote:

> Friends,
>
> I tried to install ncdf package in ubuntu with the following command.
>
> R CMD INSTALL
> --configure-args="-with-netcdf_incdir=/apps/netcdf/4.0.1/gcc/include
> -with-netcdf_libdir=/apps/netcdf/4.0.1/gcc/lib" ncdf_1.6.tar.gz
>
> The installation was stopped throwing the following error. I tried to google
> it but didnt find any solution. someone kindly write me what is going wrong.

The error message told you.

> ** libs
> gcc -std=gnu99 -I/usr/share/R/include -I/apps/netcdf/4.0.1/gcc/include
> -fpic  -g -O2 -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 -std=gnu99 -I/usr/share/R/include -I/apps/netcdf/4.0.1/gcc/include
> -fpic  -g -O2 -c ncdf2.c -o ncdf2.o
> gcc -std=gnu99 -I/usr/share/R/include -I/apps/netcdf/4.0.1/gcc/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 -shared -o ncdf.so ncdf.o ncdf2.o ncdf3.o
> -L/apps/netcdf/4.0.1/gcc/lib -lnetcdf -L/usr/lib64/R/lib -lR
> /usr/bin/ld: /apps/netcdf/4.0.1/gcc/lib/libnetcdf.a(attr.o): relocation
> R_X86_64_32 against `.rodata' can not be used when making a shared object;
> recompile with -fPIC
> /apps/netcdf/4.0.1/gcc/lib/libnetcdf.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> make: *** [ncdf.so] Errore 1
> ERROR: compilation failed for package ?ncdf?
> * Removing ?/usr/local/lib/R/site-library/ncdf?
>
> 	[[alternative HTML version deleted]]
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list