Buiding R statsitical package using SunStudio 12 : linking problem

On an athlon64 running SUSE 10.2 and an opteron running SLES 9 I can build R version 2.5.1 (http://www.r-project.org/) with no problem using gcc. The configure works fine, but make stops at a linking error using SS12 compilers.

Error:

/export/isos/Sun_Studio/sunstudio12/bin/cc -V -m64 -shared -fPIC-V -m64 -fPIC -o libRblas.so blas.ocmplxblas.o

cc: Sun C 5.9 Linux_i386 2007/05/03

cc: Sun C 5.9 Linux_i386 2007/05/03

/usr/bin/ld: blas.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

blas.o: could not read symbols: Bad value

GNU ld version 2.17.50.0.5 20060927 (SUSE Linux)

This link error occurs whether I use -fast or not.

I compiled both blas.ocmplxblas.o using -fPIC as requested (see below) but it still does not work. Am I missing something?

/export/isos/Sun_Studio/sunstudio12/bin/f77 -V -m64 -G -fPIC-m64 -shared -c blas.f -o blas.o

NOTICE: Invoking /export/isos/Sun_Studio/sunstudio12/bin/f90 -f77 -ftrap=%none -V -m64 -G -fPIC -m64 -shared -c blas.f -o blas.o

f90: Warning: Option -fPIC passed to ld, if ld is invoked, ignored otherwise

f90: Warning: Option -shared passed to ld, if ld is invoked, ignored otherwise

f90: Sun Fortran 95 8.3 Linux_i386 2007/05/03

f90comp: Sun Fortran 95 8.3 Linux_i386 2007/05/03

/export/isos/Sun_Studio/sunstudio12/bin/f77 -V -m64 -G -fPIC-m64 -shared -c cmplxblas.f -o cmplxblas.o

NOTICE: Invoking /export/isos/Sun_Studio/sunstudio12/bin/f90 -f77 -ftrap=%none -V -m64 -G -fPIC -m64 -shared -c cmplxblas.f -o cmplxblas.o

f90: Warning: Option -fPIC passed to ld, if ld is invoked, ignored otherwise

f90: Warning: Option -shared passed to ld, if ld is invoked, ignored otherwise

f90: Sun Fortran 95 8.3 Linux_i386 2007/05/03

f90comp: Sun Fortran 95 8.3 Linux_i386 2007/05/03

Compile flags set in configure for the Makefile:

export CC=/export/isos/Sun_Studio/sunstudio12/bin/cc

export CXX=/export/isos/Sun_Studio/sunstudio12/bin/CC

export F77=/export/isos/Sun_Studio/sunstudio12/bin/f77

export F90=/export/isos/Sun_Studio/sunstudio12/bin/f95

export FC=/export/isos/Sun_Studio/sunstudio12/bin/f95

export CFLAGS="-m64 -fPIC"

export CXXFLAGS="-m64 "

export FFLAGS="-m64 -shared"

export FCFLAGS="-m64 -shared"

export CPICFLAGS="-V -m64-G -fPIC "

export CXXPICFLAGS="-V -m64 -G -fPIC "

export FCPICFLAGS="-V -m64 -G -fPIC "

export FPICFLAGS="-V -m64 -G -fPIC "

export SHLIB_LDFLAGS="-V -m64 -shared -fPIC "

export SHLIB_CXXLDFLAGS="-V -m64 -shared -fPIC "

export LDFLAGS="-V -m64 -fPIC "

[2728 byte] By [leonardz77a] at [2007-11-27 10:15:11]
# 1

I believe this is because of differences in options names. With Sun compilers, you need to use -Kpic instead of -fPIC and -G instead of -shared.

MaximKartasheva at 2007-7-28 15:37:59 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

Its ok to use -fPIC/-shared for Sun Studio 12 C compiler (cc).

Yet C++/Fortran still require -KPIC and -G.

regards,

__Fedor.

SFVa at 2007-7-28 15:37:59 > top of Java-index,Development Tools,Solaris and Linux Development Tools...