[f2py] f2py and lapack DLARUV

Stephane Raynaud stephane.raynaud at gmail.com
Fri May 20 10:39:20 EEST 2011


Hi,

trying to build a fortran extension linked to lapack (f77), I faced a
problem that I reduced to the following example.

------------ testfile.f90 ------------
subroutine testfunc
   integer,parameter :: n=2
   integer :: iseed(4)
   real(kind=8) :: x(n)
   iseed = (/0,1,3,4/)
   call DLARUV(iseed, n, x)
end subroutine testfunc
--------------------------------------

Then :  f2py -c -m testmod -llapack -lblas
-L/home/raynaud/soft/lapack_gfortran/lib testfile.f90

It rises the following error (using gfortran) :

  /usr/bin/gfortran -Wall -Wall -shared
/tmp/tmpzBIKPf/tmp/tmpzBIKPf/src.linux-x86_64-2.6/testmodule.o
/tmp/tmpzBIKPf/tmp/tmpzBIKPf/src.linux-x86_64-2.6/fortranobject.o
/tmp/tmpzBIKPf/test.o -L/home/raynaud/soft/lapack_gfortran/lib
-L/soft/cdat/5.2.0/lib -llapack -lblas -lpython2.6 -lgfortran -o
./test.so
  /usr/bin/ld:
/home/raynaud/soft/lapack_gfortran/lib/liblapack.a(dlaruv.o):
relocation R_X86_64_32S against `.data' can not be used when making a
shared object; recompile with -fPIC
  /home/raynaud/soft/lapack_gfortran/lib/liblapack.a: could not read
symbols: Bad value


BLAS and LAPACK where compilated with gfortran and options '-fPIC -O3'.

I tried to use the DATA statement directly in a subroutine that I
converted to a python module, and it worked.


Any idea ?

Thanks.

-- 
Stephane Raynaud



More information about the f2py-users mailing list