下载安装包FFTW Download Pagehttp://fftw.org/download.html
解压
tar -xzvf fftw-3.3.10.tar.gz
安装(动态链接库 default double-precision (double
).)
部分选项说明(具体参考Installation on Unix (FFTW 3.3.10))
安装目录可以通过--prefix指定(默认安装通常需要root权限)
--enable-shared :创建动态链接库
1、./configure --prefix=/home/***/fft/fftw-3.3.10/build CFLAGS=-fPIC CXXFLAGS=-fPIC --enable-shared
2、make
3、make install
结果
一、常见问题:
动态库中调用静态库(libfftw3.a)
libfftw3.a(apiplan.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
二、原因分析:
Assuming you are generating a shared library, most probably what happens is that the variant of libfftw3.a
you are using wasn't compiled with -fPIC
. In linux, you can confirm this by extracting the object files from the static library and checking their relocations:
ar -x libfftw3.a
readelf --relocs apiplan.o | egrep '(GOT|PLT|JU?MP_SLOT)'
If the output is empty, then the static library is not position-independent and cannot be used to generate a shared object.
Since the static library contains object code which was already compiled, providing the -fPIC flag won't help.
You need to get ahold of a version of libfftw3.a compiled with -fPIC
and use that one instead.
三、解决方案:
1、./configure --prefix=/home/***/fft/fftw-3.3.10/build CFLAGS=-fPIC CXXFLAGS=-fPIC
2、make
3、make install
四、参考:
https://stackoverflow.com/questions/19768267/relocation-r-x86-64-32s-against-linking-error