recompile with -fPIC

Hi I have suse 11.1 64 bit
I’m trying to install R package and I’m getting and error all the time

my command line
R CMD INSTALL …/xcms_1.20.1.tar.gz

the output is:
.
.
.
.
g++ -shared -L/usr/local/lib64 -o xcms.so obiwarp/mat.o obiwarp/vec.o obiwarp/xcms_dynprog.o obiwarp/xcms_lmat.o obiwarp/xcms_obiwarp.o mzClust_hclust.o mzROI.o netCDF.o ramp_base64.o ramp.o rampR.o util.o xcms.o -L/usr/local/lib -L/sw/lib -lnetcdf -lz -L/usr/lib64/R/lib -lR
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/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: *** [xcms.so] Error 1
ERROR: compilation failed for package ‘xcms’

  • removing ‘/usr/lib64/R/library/xcms’

I just want to add that before I installed the R file I also wrote the code :
export CFLAGS=-fPIC

Thank you
Shahar

It seems to be using the C++ compiler, I’d try exporting CPPFLAGS instead of CFLAGS (or both)

CPPFLAGS are for the preprocessor. He should use CXXFLAGS instead or both CPPFLAGS and CXXFLAGS