You are not logged in.

#1 2010-10-06 06:37:58

darenw
Member
From: Trego Montana
Registered: 2008-07-04
Posts: 106
Website

[SOLVED] Trouble with atlas-lapack static library linking to our .so

I'm trying to compile a massive hunk of software, one small piece of which is libgraphics.so.   The build system, based on cmake,  is trying to link a static library from lapack to make the libgraphics.so but failing with this:

...
Linking CXX shared library libgraphics.so                                                                                     
/usr/bin/ld: /usr/local/lib/liblapack.a(dgetrf.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblapack.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [graphics/libgraphics.so.3.1.0] Error 1
...

Thinking lapack.a somehow wasn't built right, after some fussing I ended up removing  the blas, lapack, and atlas libraries and reinstalling them from the AUR atlas-lapack (ver 3.8.3)  package.  This is where they had come from originally just a few months ago, when I first tried to compile this massive app.    Maybe now something in atlas-lapack got fixed?  No.   Apparently it builds static libraries without -fPIC, or something else is going on to result in this error.  I didn't see anything obvious in the PKGBUILD file to change. 

Now I'm stuck, out of further ideas to try...

Last edited by darenw (2010-10-06 20:48:40)


Artist/Physicist, Herder of Pixels, Photons and Electrons

Offline

#2 2010-10-06 06:45:40

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,400
Website

Re: [SOLVED] Trouble with atlas-lapack static library linking to our .so

It looks like we need to add:

CFLAGS="$CFLAGS -fPIC"

to the lapack PKGBUILD.   File a bug report requesting that.

Offline

#3 2010-10-06 07:05:26

darenw
Member
From: Trego Montana
Registered: 2008-07-04
Posts: 106
Website

Re: [SOLVED] Trouble with atlas-lapack static library linking to our .so

I was going to mention in the post that I had set  CFLAGS to include -fPIC, but wasn't sure if I really had.  Turns out not;  I had set CFLAGS, but in a different xterm.   

Now it _is_ set, and I'm recompiling...


Artist/Physicist, Herder of Pixels, Photons and Electrons

Offline

#4 2010-10-06 20:36:14

darenw
Member
From: Trego Montana
Registered: 2008-07-04
Posts: 106
Website

Re: [SOLVED] Trouble with atlas-lapack static library linking to our .so

Problem solved.  CMake was finding a stray old .a file (w/o any .so files with it)  in /usr/local/lib while the good new .a and .so files were in /usr/lib.     Deleted the old .a, reran cmake.  Now make runs fine.   -fPIC had nothing to do with the solution.


Artist/Physicist, Herder of Pixels, Photons and Electrons

Offline

Board footer

Powered by FluxBB