[Rd] looks in liblapack.a not liblapack.so

Martyn Plummer plummer at iarc.fr
Mon Sep 19 10:44:00 CEST 2005


On Sat, 2005-09-17 at 17:19 -0500, Charles Geyer wrote:
> I can't compile R-alpha on AMD 64.  Rather than include a 1400 line script
> I have put it on the web
> 
>     http://www.stat.umn.edu/~charlie/typescript.txt
> 
> way down near the bottom it fails building lapack.so
> 
>     gcc -shared -L/usr/local/lib64 -o lapack.so  Lapack.lo    -llapack -lblas -lg2c -lm -lgcc_s
>     /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../lib64/liblapack.a(dgecon.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
>     /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../lib64/liblapack.a: could not read symbols: Bad value
> 
> The 'recompile with -fPIC' is bullsh*t.  The problem is that is is looking
> in /usr/lib64/liblapack.a rather than /usr/lib64/liblapack.so.3 both of which
> exist.  Some searching for this error message on Google shows a lot of
> questions about this problem but no solution that I found other than
> 
>     rm /usr/lib64/liblapack.a
> 
> which I don't consider a solution.  It will link with the .so as the bottom
> of the script shows
> 
>     snowbank$ cd src/modules/lapack
>     snowbank$ gcc -shared -o lapack.so Lapack.lo -llapack -lblas -lg2c -lm -lgcc_s
>     /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../lib64/liblapack.a(dgecon.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
>     /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../lib64/liblapack.a: could not read symbols: Bad value
>     collect2: ld returned 1 exit status
>     snowbank$ gcc -shared -o lapack.so Lapack.lo /usr/lib64/liblapack.so.3 -lblas -l g2c -lm -lgcc_s
> 
> No problems with the second link.
> 
> So what do I do?  liblapack.so is there.  I've linked other (non-R) programs
> to it.  So it SHOULD work with R.
> 
> Either I can't read (possible) or the solution to this isn't in the gcc info
> pages.
> 
> System (more info in typescript).
> 
>    AMD 64
>    SuSE linux 9.3
>    GCC 3.3.5
> 
> I also observed the same problem with R-2.1.1 but didn't get around to
> debugging it until today.
> 
> It occurred to me that /usr/local/lib/liblapack.so.3 which is 32 bit
> (because right now we are running only one R on both 32 and 64 bit and
> that's where the 32 bit R finds it's shared libraries), but I don't
> think that's the problem.  Well maybe it is.  How do I tell configure
> NOT to add /user/local ?

You would need to modify the LDFLAGS and CPPFLAGS environment variables,
as these default to -L/usr/local/lib and -I/usr/local/include
respectively.  See Appendix B.3.3 of the R Installation and
Administration manual, which gives a warning about 64-bit systems.

You can also use the --with-readline configure flag to specify the exact
location of the readline library you wish to use.

I hope this helps.
Martyn


-----------------------------------------------------------------------
This message and its attachments are strictly confidential. ...{{dropped}}



More information about the R-devel mailing list