0

I am trying to compile a whole fortran pack for python with f2py. The pack is this one. The problem is that most of the subroutines depend on other subroutines and etc and I can't compile successfully.

I wrote a bash script that loops through all the files and compiles with

FILES=*.f
for f in $FILES
do
  echo ${f%??}
  f2py -c --fcompiler=gfortran -m ${f%??} $f
done

So as a example for rfftf1.f it does:

f2py -c --fcompiler=gfortran -m rfftf1 rfftf1.f

and the .so files are generated but when I import them into python I have

ImportError: ./rfftf1.so: undefined symbol: radf5_

Is there a way to compile everything into their own .so files as I intended or do I have to somehow merge everything together?

Thank you.

TomCho
  • 3,204
  • 6
  • 32
  • 83
  • This might not be an appropriate comment, but I am wandering in the first place why you want to compile your own fft for python? There is one in numpy http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft.html#numpy.fft.fft .Maybe it is not appropriate for your problem. – innoSPG Aug 07 '15 at 15:12
  • @innoSPG I understand, but this is merely an example of the problem I'm trying to solve. I'm actually writing something else with the same issues, but it wouldn't be as easy to post the whole code. Thank you anyway for the concern. – TomCho Aug 07 '15 at 15:36
  • I understand better! What you can do is making a small reproduction of what you are doing with 2 or 3 files having 1 small subroutine each. They do not need to be meaningful. You will get more support, there is a lot of people who are eager to learn, myself included. I remember having a hard time compiling more than one file to a library with f2py. I do not even remember how I did it finally. So I am interested in what you are doing. I will give few minutes to try and see if I can help, provided a small example. – innoSPG Aug 07 '15 at 16:03
  • I have little experience with f2py (so not very sure) but this page looks like talking the same problem, so worth trying...? http://osdir.com/ml/python.f2py.user/2006-08/msg00019.html – roygvib Aug 08 '15 at 05:46

0 Answers0