[f2py] f2py and lapack DLARUV
Pearu Peterson
pearu.peterson at gmail.com
Fri May 20 12:35:28 EEST 2011
On 05/20/2011 10:39 AM, Stephane Raynaud wrote:
> 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'.
Are you absolutely sure?
Can you try creating the testmod without using lapack and blas libraries
but their sources? For example:
f2py -m testmod testfile.f90 -h testfile.pyf
f2py testfile.pyf /path/to/lapack/src/*.f /path/to/blas/src/*.f
Pearu
> I tried to use the DATA statement directly in a subroutine that I
> converted to a python module, and it worked.
>
>
> Any idea ?
>
> Thanks.
>
More information about the f2py-users
mailing list