Error during Make stage

GROMACS version:2021.7 , 2021.6 , 2022.5 , 2023
GROMACS modification: No

Hey all,
I am trying to build gromacs 2021.7 using Mingw64 on Windows 10 (pro , x64) (without gpu support). & cpu: core-i7.
Used Cmake-GUI (3.25.2) for configuration. (FFTW , BUILD_SHARED_LIBS=On , GMX_PREFERE_STATIC_LIBS=Off , GMX_BUILD_SHARED_EXE=On).

The build process runs fine up until Make stage during which I get following error in the output:

[ 56%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/timing/cyclecounter.cpp.obj
cd /d C:\Users\Sony\Downloads\gromacs-2021.7\build\src\gromacs && C:\mingw64\bin\c++.exe -DGMX_DOUBLE=0 -DHAVE_CONFIG_H -DNOMINMAX -DUSE_STD_INTTYPES_H -Dlibgromacs_EXPORTS @CMakeFiles/libgromacs.dir/includes_CXX.rsp -O3 -DNDEBUG -std=c++17 -msse2 -Wno-missing-field-initializers -fexcess-precision=fast -funroll-all-loops -fopenmp -MD -MT src/gromacs/CMakeFiles/libgromacs.dir/timing/cyclecounter.cpp.obj -MF CMakeFiles\libgromacs.dir\timing\cyclecounter.cpp.obj.d -o CMakeFiles\libgromacs.dir\timing\cyclecounter.cpp.obj -c C:\Users\Sony\Downloads\gromacs-2021.7\src\gromacs\timing\cyclecounter.cpp
C:\Users\Sony\AppData\Local\Temp\ccHkgd3l.s: Assembler messages:
C:\Users\Sony\AppData\Local\Temp\ccHkgd3l.s:27: Error: register type mismatch for xchg' C:\Users\Sony\AppData\Local\Temp\ccHkgd3l.s:29: Error: register type mismatch for xchg’
C:\Users\Sony\AppData\Local\Temp\ccHkgd3l.s:38: Error: register type mismatch for xchg' C:\Users\Sony\AppData\Local\Temp\ccHkgd3l.s:40: Error: register type mismatch for xchg’
mingw32-make.exe[2]: *** [src\gromacs\CMakeFiles\libgromacs.dir\build.make:5021: src/gromacs/CMakeFiles/libgromacs.dir/timing/cyclecounter.cpp.obj] Error 1
mingw32-make.exe[2]: Leaving directory ‘C:/Users/Sony/Downloads/gromacs-2021.7/build’
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:4104: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory ‘C:/Users/Sony/Downloads/gromacs-2021.7/build’
mingw32-make.exe: *** [Makefile:168: all] Error 2

To resolve the issue, I tried different releases of GROMACS source codes, namely, 2021.6 , 2021.7 , 2022.5 & 2023 which all resulted in the same error. Also tried different versions of Mingw64 (entailing GNU 12.2 OR GNU11.2) with no improvements. Will appreciate any advices/Insights , Thanks!

Hello!

Mingw compilers are not supported. On Windows, you can use Visual Studio, Intel oneAPI, or Ubuntu over WSL.

If you are feeling adventurous and intent on fixing Mingw build, perhaps you can open src/gromacs/timing/cyclecounter.cpp file and replace, around line 79,

         && defined(__x86_64__) && !defined(__ILP32__) && !defined(_CRAYC))

with

         && defined(__x86_64__) && !defined(__ILP32__) && !defined(_CRAYC) && !defined(__MINGW32__))

But that’s just a guess based on your error message. There could be more problems out there. Switching to Visual Studio or Linux in WSL is the better way.

Hi,
So I compiled 2023 and 2021.6 & 7 releases with Visual Studio compilers as per your advice and this time it generated the binaries apparently smoothly with no obvious errors but after making and installing stages (and adding fftw3f-3.dll to bin folder of install dir.), again I can not run gmx.exe (not even from the bin directory itself) ,instead an error message is prompted declaring the application was not able to start correctly. again tried tweaking option for shared libraries , in the hope to resolve the issue, with no success! any suggestions to get over this problem is greatly appreciated.

PS. btw, i tried the more adventurous method you proposed , it went fine to 100% of compilation but when trying to link the libraries an error stopped it going any further. I wonder if these two situations are somewhat related?!

Can you try using dumpbin or some other tools described in this SO thread to see which libraries are loaded by bin/gmx.exe and lib/libgromacs.dll? The error seems to be caused by something in your environment, so hard to diagnose (especially since Windows is not a primary platform for any of the code GROMACS developers).

Thanks for the advice. ran a dependency analysis based on your suggestion and to my surprise i got the mesage that gmx.exe depends on MKL_INTEL_THREAD.DLL which is not installed on my system. a bit surprised, as i did chose fftw as my default fft library and set include dir for it during config. any idea why?
am currently trying 2 install intel mkl on my sys. with the hope that this finally will get me through.