I’m attempting to use a c numerical library in python that relies on fftw3 using Ctypes. Let’s say I have a program that looks like this:
foo.cc:
#include <fftw3.h>
extern "C"{
void foo(){
fftw_complex *result;
result = fftw_alloc_complex(1024*1024*1024);
}
I then compile this using:
icpc -O3 -fpic -c foo.cc -o foo.o
icpc -shared -o libfoo.so foo.o -lfftw3
When i try to load it into python using ctypes, it doesn’t seem to have linked properly:
import ctypes
lib = ctypes.cdll.LoadLibrary('libfoo.so')
Python prints:
OSError: libfoo.so:
undefined symbol: fftw_alloc_complex
I was initially using a fresh install of fftw 3.1 set up with
./configure
make
make install
but I have subsequently tried recompiling fftw with a variety of different options like ‘-fPIC’ as outlined here. This gives an identical error message, and I’m now out of ideas. This same procedure has worked for importing other libraries into python that use external libs like the GSL before, so I don’t know what is going wrong with FFTW3. Any help would be greatly appreciated.
~Doug
On the advice of a coworker I searched for and manually deleted all of the fftw related dlls, then made and installed again using the correct flags
-fpic. It seems the fftw uninstall script does not completely remove previous versions of fftw.