All -
I believe I have fixed a compile-time error under Unix/Linux in the
fftpack module of scipy. I found this problem in some of the older
tgz's (source and binary forms), as well as the last three days' CVS
versions. I found no published reference to this error or solution, so
I hope this isn't just additional noise on the list.
Problem:
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/scipy/__init__.py", line 49, in
?
import special, io, linalg, stats, fftpack
File "/usr/lib/python2.2/site-packages/scipy/fftpack/__init__.py",
line 55, in ?
from pseudo_diffs import *
File "/usr/lib/python2.2/site-packages/scipy/fftpack/pseudo_diffs.py",
line 12, in ?
import convolve
ImportError: /usr/lib/python2.2/site-packages/scipy/fftpack/convolve.so:
undefined symbol: fftw_lookup
Diagnosis:
Analysis reveals that the FFTW libraries are being linked in the wrong
order, causing the fftw_lookup object to be obscured and lost. Looking
into the scipy/scipy_distutils/system_info.py script reveals that in
every position except one, the *rfftw libraries properly precede the
*fftw library (all the precisions are in there, with rfftw and fftw
being the default case). This default case is in the wrong order, with
fftw in front of rfftw. Doesn't it just suck that we still have these
kinds of problems? You'd think our compilers could figure it out by
now. :)
Solution:
The fix is trivial - just reorder the libraries in the list (it looks
like this is already OK for all the other precisions in the script, just
not this particular one):
Roughly line #324 of scipy/scipy_distutils/system_info.py:
you want to use
libs = ['rfftw','fftw']
instead of
libs = ['fftw','rfftw']
A diff patch is included below. This is against the 03 February 2003
CVS (not that the date really matters - it looks like the same file as
the Oct 2002 Sun build that's in the download area).
Now that I've got it running, I can't wait to throw my Matlab support
agreement into a ditch. OK, maybe that's cruel and a bit optimistic,
but I sure hope so anyway.
Also, this was built on a mostly stock Red Hat 8.0 system, in case that
matters to anyone.
Cheers,
- Bill Alexander
diff -u scipy/scipy_distutils/system_info.py
scipy_fixed/scipy_distutils/system_info.py
--- scipy/scipy_distutils/system_info.py 2002-10-14
16:04:20.000000000 -0700
+++ scipy_fixed/scipy_distutils/system_info.py 2003-02-03
23:31:03.000000000 -0800
@@ -321,7 +321,7 @@
class fftw_info(system_info):
section = 'fftw'
dir_env_var = 'FFTW'
- libs = ['fftw','rfftw']
+ libs = ['rfftw','fftw']
includes = ['fftw.h','rfftw.h']
macros = [('SCIPY_FFTW_H',None)]