[Numpy-discussion] f2py - how to use .pyf files?
Fernando Perez
fperez.net@gmail....
Fri Jul 18 18:19:15 CDT 2008
On Fri, Jul 18, 2008 at 3:53 PM, Robert Kern <robert.kern@gmail.com> wrote:
> You still need "-m text2", I believe.
Right, thanks. But it still doesn't quite work. Consider a makefile with
lib: seglib.so
seglib.so: Text2.f90
f2py -c --fcompiler=gnu95 -m seglib Text2.f90
pyf: Text2.f90
f2py -h seglib.pyf -m seglib Text2.f90 --overwrite-signature
lib2: Text2.f90
f2py -c --fcompiler=gnu95 seglib.pyf
If I type
make lib
it works fine, but
make pyf
make lib2
bombs out with:
gfortran:f90: /tmp/tmpNgmzmT/src.linux-i686-2.5/seglib-f2pywrappers2.f90
/tmp/tmpNgmzmT/src.linux-i686-2.5/seglib-f2pywrappers2.f90:7.41:
use seg_functions, only : g_tilde2d
1
Fatal Error: Can't open module file 'seg_functions.mod' for reading at
(1): No such file or directory
/tmp/tmpNgmzmT/src.linux-i686-2.5/seglib-f2pywrappers2.f90:7.41:
use seg_functions, only : g_tilde2d
1
Fatal Error: Can't open module file 'seg_functions.mod' for reading at
(1): No such file or directory
error: Command "/usr/bin/gfortran -Wall -fno-second-underscore -fPIC
-O3 -funroll-loops -march=i686 -mmmx -msse2 -msse -msse3
-fomit-frame-pointer -malign-double
-I/tmp/tmpNgmzmT/src.linux-i686-2.5
-I/home/fperez/usr/opt/lib/python2.5/site-packages/numpy/core/include
-I/usr/include/python2.5 -c -c
/tmp/tmpNgmzmT/src.linux-i686-2.5/seglib-f2pywrappers2.f90 -o
/tmp/tmpNgmzmT/tmp/tmpNgmzmT/src.linux-i686-2.5/seglib-f2pywrappers2.o"
failed with exit status 1
make: *** [lib2] Error 1
Is it obvious what I'm doing wrong?
>> to create the .pyf, edited the pyf to adjust and 'pythonize' the
>> interface, and then when I try to build using this pyf, I get a crash
>> and the *same* gfortran option is now not recognized:
>>
>> maqroll[felipe_fortran]> f2py -c --fcompiler=gfortran text2.pyf
>> Unknown vendor: "gfortran"
>
> It's --fcompiler=gnu95, not --fcompiler=gfortran
The funny thing is that 'gfortran' does work for the plain call
f2py -c --fcompiler=gfortran Text2.f90
just fine, but not for the other forms. So it's easy to be misled
into thinking that it might actually be the correct call. Clever
trick to trap the unwary :)
Cheers,
f
More information about the Numpy-discussion
mailing list