[f2py] f2py + F90 problems

Pearu Peterson pearu at cens.ioc.ee
Mon Jun 23 09:41:57 EEST 2008


On Mon, June 23, 2008 3:51 am, Bruno Fletcher wrote:
> Hi there,
>
> I am having issues when I try to compile a module based F90 sample
> code with f2py;  in my case, I'm just trying to run the "allocarr"
> example from the f2py documentation. I downloaded the code from the
> documentation's website
> (http://cens.ioc.ee/projects/f2py2e/usersguide/allocarr.f90), and then
> I invoke f2py to compile module:
>
> fletcher at fletcher-laptop:~/Desktop$ f2py -c
> --f90exec=/usr/bin/gfortran -m allocarr allocarr.f90
..

> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: ./allocarr.so: undefined symbol: _gfortran_st_write_done
>
> Does anyone have an idea of what might be causing this error?

Yes, you should invoke f2py using --fcompiler=gnu95 switch
in order to use gfortran:

  f2py -c --fcompiler=gnu95 -m allocarr allocarr.f90

Otherwise, although with --f90exec the Fortran code is compiled with
gfortran but the module is still linked with the g77, and hence
the gfortran undefined symbol.

HTH,
Pearu




More information about the f2py-users mailing list