Declaration mismatches for popen and pclose

GROMACS version: 2020.4
GROMACS modification: no
I have found this particular problem in a couple of different environments: Cygwin and RHEL 7.4

Build command:

cmake … -DGMX_BUILD_OWN_FFTW=ON -DBUILD_SHARED_LIBS=OFF -DREGRESSIONTEST_DOWNLOAD=ON

There are declaration mismatches for popen and pclose. This particular example occurs for futil.cpp. In each case, the initial declaration is ‘extern’ and later ‘static’. This happened at about [30%] in the build.

Full error dump:


/home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.cpp:172:14: error: ‘FILE* popen(const char*, const char*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
172 | static FILE* popen(const char* nm, const char* mode)
| ^~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/cstdio:42,
from /home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.h:49,
from /home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.cpp:39:
/usr/include/stdio.h:345:9: note: previous declaration of ‘FILE* popen(const char*, const char*)’
345 | FILE * popen (const char , const char *);
| ^~~~~
/home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.cpp:179:12: error: ‘int pclose(FILE
)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
179 | static int pclose(FILE* fp)
| ^~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/cstdio:42,
from /home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.h:49,
from /home/A132590/gromacs/gromacs-2020.3/src/gromacs/utility/futil.cpp:39:
/usr/include/stdio.h:344:5: note: previous declaration of ‘int pclose(FILE*)’
344 | int pclose (FILE *);
| ^~~~~~
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:298: src/gromacs/CMakeFiles/libgromacs.dir/utility/futil.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [CMakeFiles/Makefile2:4593: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [Makefile:183: all] Error 2


This causes a fatal error for the build. Any ideas?