From p.dalgaard at biostat.ku.dk  Thu Feb 26 11:49:28 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Thu Feb 26 11:49:43 2004
Subject: [Rd] ATLAS threaded 64 bit (Opteron) - need *.so?
In-Reply-To: <16445.47460.107721.166477@gargle.gargle.HOWL>
References: <16445.47460.107721.166477@gargle.gargle.HOWL>
Message-ID: <x27jyaf747.fsf@biostat.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:

> and compilation (of course) goes fine till the crucial linking
> stage :
> 
> gcc -shared   -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo  -lf77blas -latlas -L/usr/lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lfrtbegin -lg2c -lm -lgcc_s
> /usr/bin/ld: /usr/local/lib/libf77blas.a(xerbla.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
> /usr/local/lib/libf77blas.a: could not read symbols: Bad value
> collect2: ld returned 1 exit status
> 
> and I'm stuck to some extent.
> Note that the "recompile with -fPIC"  must related to the
> contents of ATLAS' libf77blas.a itself (or to "xerbla.o" more
> concretely), since all of R's  dlapack[0-3].lo are of course
> compile with -fPIC.
> 
> I tend to conclude that I do need shared versions of ATLAS'
> libraries?  If yes, I think I've seen instructions on how to
> build these.  Where?
> If these are really needed, I think I should add them to the
> corresponding "R administration manual" section, right?

I don't think we actually got them written down (thank you for
volunteering...) but it isn't terribly hard. There are just two basic
tricks:

- add -fPIC all over the place during configure.

- after building you'll get a bunch of .a files. These can be
  converted to .so using 

        ld -shared -o libfoo.so --whole-archive libfoo.a

One thing I haven't gotten around to yet is the ATLAS/LAPACK
integration mentioned on
http://math-atlas.sourceforge.net/errata.html#completelp
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] ATLAS threaded 64 bit (Opteron) - need *.so?
Peter Dalgaard