GROMACS nmake error1181

GROMACS version: 2024.3
GROMACS modification: No
OS: Windows 10
Microsoft Visual Studio 2022
IntelOneAPI 2025 MKI and DPC++/C++ Compiler
Python 3.13.0

Greetings, experienced GROMACS users.
I am a new GROMACS user currently trying to install it on my laptop. I followed the instruction here from intel for using cmake command (https://www.intel.com/content/www/us/en/developer/articles/training/build-gromacs-with-intel-oneapi-dpc-c-compiler.html)

When I finished nmake, however, I got an error as follow:

C:\WINDOWS\system32\cmd.exe /C “C:\WINDOWS\system32\cmd.exe /C ““C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -E __create_def C:\gromacs-2024.3\build\src\gromacs\CMakeFiles\libgromacs.dir.\exports.def C:\gromacs-2024.3\build\src\gromacs\CMakeFiles\libgromacs.dir.\exports.def.objs && cd C:\gromacs-2024.3\build” && “C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -E vs_link_dll --intdir=src\gromacs\CMakeFiles\libgromacs.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests – C:\PROGRA~2\Intel\oneAPI\compiler\latest\bin\icx.exe /nologo @CMakeFiles\libgromacs.rsp -LD /Qoption,link,/machine:x64 /Qoption,link,/INCREMENTAL:NO -fsycl -fsycl-device-code-split=per_kernel -ftarget-register-alloc-mode=pvc:small -Qiopenmp /Qoption,link,/DEF:src\gromacs\CMakeFiles\libgromacs.dir.\exports.def -link /out:bin\gromacs.dll /implib:lib\gromacs.lib /pdb:bin\gromacs.pdb /version:9.0 && cd .”
LINK: command “C:\PROGRA~2\Intel\oneAPI\compiler\latest\bin\icx.exe /nologo @CMakeFiles\libgromacs.rsp -LD /Qoption,link,/machine:x64 /Qoption,link,/INCREMENTAL:NO -fsycl -fsycl-device-code-split=per_kernel -ftarget-register-alloc-mode=pvc:small -Qiopenmp /Qoption,link,/DEF:src\gromacs\CMakeFiles\libgromacs.dir.\exports.def -link /out:bin\gromacs.dll /implib:lib\gromacs.lib /pdb:bin\gromacs.pdb /version:9.0 /MANIFEST:EMBED,ID=2” failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file ‘m.lib’
icx: error: linker command failed with exit code 1181 (use -v to see invocation)
ninja: build stopped: subcommand failed.

From my understanding, the error 1181 is related to the lack of m.lib, which I cannot find anywhere on my PC. Is there any way to fix this? Or am I missing someprequisite?

Hi! Thanks for sharing this issue.

This is a bug in GROMACS build configuration system. The easiest solution for you would be to edit the top-level CMakeLists.txt in the GROMACS source directory, modifying the line 897 to use libm instead of m:

 # Math and thread libraries must often come after all others when linking...
 if (HAVE_LIBM)
-    list(APPEND GMX_PUBLIC_LIBRARIES m)
+    list(APPEND GMX_PUBLIC_LIBRARIES libm)
 endif()

Could you confirm whether this fixes the problem for you? If so, we’ll try to add the fix to the next release.

Hi! This fix works. The GROMACs compiled nicely through the NMake and install process. Though I am now stuck with MDrun not working.

Hi! Thanks for checking the fix. Could you share the error you’re getting from gmx mdrun?

Unfortunately it is not as much of a error as there is nothing happening at all on the console. I believe that the there is something missing during the compilation.

C:\Program Files (x86)\Intel\oneAPI>gmx mdrun
:-) GROMACS - gmx mdrun, 2024.4 (-:

Executable: C:\gromacs2\bin\gmx.exe
Data prefix: C:\gromacs2
Working dir: C:\Program Files (x86)\Intel\oneAPI
Command line:
gmx mdrun

C:\Program Files (x86)\Intel\oneAPI>

Even when I try to look for mdrun with:
gmx help mdrun

Nothing came up
C:\Program Files (x86)\Intel\oneAPI>gmx help mdrun
:-) GROMACS - gmx help, 2024.4 (-:

Executable: C:\gromacs2\bin\gmx.exe
Data prefix: C:\gromacs2
Working dir: C:\Program Files (x86)\Intel\oneAPI
Command line:
gmx help mdrun

C:\Program Files (x86)\Intel\oneAPI>

Curious. I’m stumbled here. But could you try a few more things?

Does printing GROMACS version info works?

 C:\Program Files (x86)\Intel\oneAPI>gmx --version

Also, what is the %errorlevel% value after the “crash”?

 C:\Program Files (x86)\Intel\oneAPI>gmx help mdrun
 C:\Program Files (x86)\Intel\oneAPI>echo  %errorlevel%