Re: [f2py] Linking to static library quadpack
Pearu Peterson <[email protected]> Wed, 24 Nov 2010 08:02:02 +0200
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, Python extension modules are shared libraries. It means that when linking it with another library (or object file), the library must be compiled with -fPIC compiler option. So, in your case actually the static quadpack library is not ok for linking with an extension module. The fact that the linkage works with gfortran is irrelevant as the result of gfortran call is a static program. So, try to recompile quadpack. Pearu On Wed, Nov 24, 2010 at 12:50 AM, R. O'Gara <ronogara-/[email protected]> wrote: > Hello all, > > I'm very new to f2py and have a following issue. I'm trying to link to > quadpack library in the following way > > This is in integrate.f90, just a simple integral of 2x from a to b > --- > subroutine f1(a,b,z) > implicit none > real abserr > real, parameter :: epsabs = 0.0E+00 > real, parameter :: epsrel = 0.001E+00 > real, external :: f02 > integer ier > integer, parameter :: key = 6 > integer neval > real, parameter :: pi = 3.141592653589793E+00 > real result > real, parameter :: true = 0.06278740E+00 > > real, intent(in) :: a,b > real, intent(out) :: z > call qag ( f02, a, b, epsabs, epsrel, key, result, abserr, neval, ier ) > z = result > end > real function f02 ( x ) > implicit none > real, intent(in) :: x > f02 = 2*x > end > ---- > I am trying to link this in the following way > f2py integrate.f90 $HOME/lib/f90/libquadpack.a > > (or f2py integrate.f90 -L$HOME/lib/f90 -lquadpack) > > In both cases I get the following error: > relocation R_X86_64_32S against `a local symbol' can not be used when > making a shared object; recompile with -fPIC ... > > I presume that the library itself should be ok because I use it with no > problems with other files, i.e. > gfortran example.o -L$HOME/lib/f90 -lquadpack > works just fine > > any help/hint is much appreciated! Thank you for your time. > > > > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > > _______________________________________________ f2py-users mailing list f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] http://cens.ioc.ee/mailman/listinfo/f2py-users