./configure
make
make install
To list options, use ./confiture --help
.
FFTW 3 defaults to double precision. Use --enable-float
or --enable-single
to enable single precision.
Enable x86 and x64 SIMD.
--enable-sse --enable-sse2 --enable-avx --enable-avx2 --enable-avx512 --enable-avx-128-fma
More SIMD and fma instruction. --enable-generic-simd*
options compiles to different code path.
--enable-generic-simd128 --enable-generic-simd256 --enable-fma
Disable fortran.
--disable-fortran
Set install location.
--prefix=/home/cu/code/cpp/fftCompare/install
Linux.
./configure --with-pic=yes --enable-single --enable-sse2 --enable-avx --enable-avx2 --enable-avx512 --enable-avx-128-fma --enable-fma --disable-fortran --prefix=/home/cu/code/cpp/fftCompare/install
CMake can be used.
cd fftw-<version>
mkdir build
cd build
cmake ..
cmake-gui.exe .
cmake --build . --config release
To build static library, turn off BUILD_SHARED_LIBS
.
Library is built in build/Release
directory. Header is at api/fftw3.h
.
I wasn't able to use MSYS2 static build (libfftw3.a etc.) with MSVC.
There's also a package available on MSYS2.
./configure
options.
mkdir build
cd build
# Single thread.
../configure --host=x86_64-w64-mingw32 --disable-alloca --with-our-malloc --enable-single --enable-sse2 --enable-avx --enable-avx2 --enable-fma --enable-avx-128-fma --disable-fortran --prefix="$HOME/code/fft/install" && make -j && make install
# With multi-threading.
../configure --host=x86_64-w64-mingw32 --disable-alloca --with-our-malloc --enable-single --enable-sse2 --enable-avx --enable-avx2 --enable-fma --enable-avx-128-fma --disable-fortran --enable-threads --prefix="$HOME/code/fft/install" && make -j
for lib in *.a; do echo $lib; ar -t $lib | grep gettime; done > result
libgcc.a
libmingw32.a
libmingwex.a
- And more.
Still missing library for fprintf
and __getreent
. Also libmingw32.a
contains a symbol that conflicts with MSVCRT.lib
.
libmingw32.a(lib64_libmingw32_a-tlssup.o) : warning LNK4078: multiple '.CRT' sections found with different attributes (
C0400040) [C:\Users\Golwond\code\vst\Plugins\build\CubicPadSynth\CubicPadSynth.vcxproj]
MSVCRT.lib(gs_report.obj) : error LNK2005: __report_gsfailure already defined in libmingw32.a(lib64_libmingw32_a-gs_sup
port.o) [C:\Users\Golwond\code\vst\Plugins\build\CubicPadSynth\CubicPadSynth.vcxproj]
libfftw3f.a(assert.o) : error LNK2019: unresolved external symbol __getreent referenced in function fftwf_assertion_fai
led [C:\Users\Golwond\code\vst\Plugins\build\CubicPadSynth\CubicPadSynth.vcxproj]
libfftw3f.a(assert.o) : error LNK2019: unresolved external symbol fprintf referenced in function fftwf_assertion_failed
[C:\Users\Golwond\code\vst\Plugins\build\CubicPadSynth\CubicPadSynth.vcxproj]
C:\Users\Golwond\code\vst\vst3sdk\build\VST3\Release\CubicPadSynth.vst3\Contents\x86_64-win\CubicPadSynth.vst3 : fatal
error LNK1120: 2 unresolved externals [C:\Users\Golwond\code\vst\Plugins\build\CubicPadSynth\CubicPadSynth.vcxproj]
- From MinGW static library (.a) to Visual Studio static library (.lib) - Stack Overflow
- c++ - Contents of a static library - Stack Overflow
Following 2 files are necessary.
.libs/libfftw3.a
api/fftw3.h
When linking with g++ (or clang++), order of options is important.
g++ -O3 main.cpp -lm libfftw3f.a # Correct.
# g++ -O3 -lm libfftw3f.a main.cpp # Incorrect. Link fails.
- How to Link Static Library in C/C++ using GCC compiler? | Technology of Computing
- c++ - .o files vs .a files - Stack Overflow
- c - unable to link to fftw3 library - Stack Overflow
- g++ linking order dependency when linking c code to c++ code - Stack Overflow
./configure
recipe.
Runtime SIMD detection.