基于MinGW 64位在非Unix系统安装FFTW库的问题咨询
Hey there! Let's work through your FFTW installation hurdles on Windows together—no need to stress over those tricky directories or manual compiles if you don't want to.
问题1:找不到MinGW的"kernel"和"simd-support"目录
First off, those directories aren't part of MinGW itself—they're inside the FFTW source code package you need to download separately. Here's how to get to them:
- Download the FFTW source tarball (like
fftw-3.3.10.tar.gz) from the official site, then extract it to a folder on your Windows machine. - Open your MinGW terminal (I recommend using MSYS2's Mingw64/UCRT64 shell for better compatibility) and navigate to the extracted FFTW source root directory (e.g.,
cd /c/Users/YourName/Downloads/fftw-3.3.10). - You'll now see the
kernelandsimd-supportfolders right there in the root. From here, you can compile the specific C files as per the official guide using commands like:
Note: If you're following the full compilation workflow from the docs, make sure to run thegcc -c kernel/your-target-file.c -O3./configurescript first in the MSYS2 environment—it sets up the build system for MinGW.
问题2:更优的命令行安装方式
Manual compiling can be tedious, especially if you're new to FFTW. The easiest and most reliable command-line method is using the MSYS2 package manager to install pre-built FFTW binaries. Here's how:
- Install MSYS2 (follow the setup prompts to add the Mingw64/UCRT64 environment to your PATH).
- Open the MSYS2 Mingw64 terminal (not the default MSYS shell) and update the package database first:
You might need to close and reopen the terminal after this update.pacman -Syu - Install the 64-bit FFTW3 library with one command:
(Usepacman -S mingw-w64-x86_64-fftw3mingw-w64-ucrt-x86_64-fftw3if you're using the UCRT runtime instead.) - Once installed, you can immediately link FFTW into your C/C++ projects using
-lfftw3in your compiler commands—no manual compilation or directory hunting required!
If you still prefer compiling from source for custom flags, stick with the MSYS2 environment, run ./configure with your desired options (e.g., --enable-sse2 for SIMD support), then make and make install to set up the library.
内容的提问来源于stack exchange,提问作者classic_man

