Gromacs(2016)/Spack Compilation Fails- error: 'numeric_limits' is not a member of 'std'

GROMACS version: 2016.3
GROMACS modification: No

Hello Folks,

I’m new to the HPC world and I’m playing around with Spack and Gromacs. I currently have the following Dockerfile

FROM ubuntu:22.04

RUN apt-get update && DEBIAN_FRONTEND="noninteractive"  \
    TZ="America/New_York" apt-get install -y tzdata
RUN apt install -y environment-modules  \
    wget gpg build-essential  \
    kmod nano dos2unix dbus systemd  \
    cgroup-tools net-tools cmake  \
    git gfortran
RUN git clone https://github.com/spack/spack /opt/Spack
RUN echo '. /opt/Spack/share/spack/setup-env.sh' >> /etc/profile
RUN /opt/Spack/bin/spack install gromacs@2016.3

When Spack is getting installed, it fails with the following error from the minimize.cpp file

some_long_path...minimize.cpp:2597:32: error: 'numeric_limits' is not a member of 'std'
 2597 |             s_try->epot = std::numeric_limits<real>::infinity();
      |                                ^~~~~~~~~~~~~~
some_long_path...mdlib/minimize.cpp:2597:51: error: expected primary-expression before '>' token
 2597 |             s_try->epot = std::numeric_limits<real>::infinity();

Does anyone have any advice on what I might be doing wrong?

Any help is greatly appreciated

Hi!

What’s going wrong is that GROMACS 2016 is too old and does not support new compilers. If you really need to use GROMACS 2016, you can add

#include <limits>

att the top (near other includes) in the troublesome files.

Thank you very much!