Wrong compiler when installing with internally built FFTW3?

GROMACS version: 2025.1
GROMACS modification: No
Hi!

I apologize ahead of time if this is an oversight on my part. I have a Linux system with two compilers, gcc (=v7) and gcc-11 (=v11). I set up a Gromacs build via:

cmake .. -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g+±11 -DGMX_SIMD=AVX2_256 -DREGRESSIONTEST_DOWNLOAD=ON -DCMAKE_INSTALL_PREFIX=/opt/gromacs_2025.1 -DGMX_FFT_LIBRARY=fftw3 -DGMX_BUILD_OWN_FFTW=ON

I noticed that when FFTW3 is built, the compilation defaults to using gcc, instead of gcc-11. Only Gromacs itself is compiled with gcc-11. I can override this by setting the environment variable CC (e.g. ‘export CC=gcc-11’) before issuing the “cmake” command, but in my opinion users might expect the “CMAKE_C_COMPILER” setting to be propagated to the compilation of FFTW. Or does all this reflect a misconfiguration in my system?

Many thanks,

Erik

Hi!

No, nothing wrong with your system. The “build own fftw3” functionality is not very sophisticated and does the simplest thing (i.e., uses the default compiler). You really should not rely on it too much (there are other known issues with it, with handling of compiler flags and the like). Nevertheless, respecting user’s compiler choice is a very reasonable assumption, so I filed a bug, Build script for "own" FFTW3 ignores the compiler choice (#5344) · Issues · GROMACS / GROMACS · GitLab.

Thank you! Much appreciated.

Erik