From charlie at stat.umn.edu  Sun Sep 18 00:19:02 2005
From: charlie at stat.umn.edu (Charles Geyer)
Date: Sat, 17 Sep 2005 17:19:02 -0500
Subject: [Rd] looks in liblapack.a not liblapack.so
In-Reply-To: <mailman.9.1126951201.11292.r-devel@r-project.org>
References: <mailman.9.1126951201.11292.r-devel@r-project.org>
Message-ID: <20050917221902.GA10806@stat.umn.edu>

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 ?
-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
charlie at stat.umn.edu



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