Gromacs 2020.4 installation failure with MPI

GROMACS version: 2020.4
GROMACS modification: Yes/No

Hello,

I am having problems installing GROMACS 2020.4 on our local cluster.

Each node of the system I am attempting to install GROMACS on is composed of 20 Intel Xeon CPUs
I am running
gcc 5.1.0
cmake 3.19.5
openmpi 4.0.5

As the nodes are not currently able to download the fftw library directly, I use a local installation
of fftw-3.3.8.

The serial executable is compiled correctly, however when configuring with the command

/opt/cmake-3.19.5-Linux-x86_64/bin/cmake … -DCMAKE_C_COMPILER=/opt/openmpi-4.0.5/bin/mpicc -DCMAKE_CXX_COMPILER=/opt/openmpi-4.0.5/bin/mpicxx -DGMX_MPI=on -DGMX_BUILD_OWN_FFTW=OFF -DGMX_GPU=off -DGMX_SIMD=AVX_256 -DCMAKE_INSTALL_PREFIX=/opt/gromacs-2020.4/gromacs_xeon -DGMX_FFT_LIBRARY=fftw3 -DFFTWF_LIBRARY=’/opt/fftw-3.3.8/bin_fftw3f/lib/libfftw3f.so’ -DFFTWF_INCLUDE_DIR=’/opt/fftw-3.3.8/bin_fftw3f/include’

executing make gives the error:

[100%] Linking CXX shared library …/…/lib/libgromacs_mpi.so
/usr/bin/ld: CMakeFiles/libgromacs.dir/listed_forces/bonded.cpp.o: relocation R_X86_64_PC32 against undefined symbol `_ZN12_GLOBAL__N_1L28c_bondedInteractionFunctionsIL18BondedKernelFlavor2EEE’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libgromacs_mpi.so.5.0.0] Error 1
make[1]: *** [src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [all] Error 2

Any idea about what could be the cause, and how to proceed ?

Thank you in advance,

AZ

I would try with -DGMX_PREFER_STATIC_LIBS=ON

Thank you for the suggestion,

Unfortunately it does not seem to have any effect on the issue.
I receive the same error message.

Apologies if this is a trivial question, but should the same flag be used also when compiling the serial code?

AZ

I have built 2021.1 and 2020.5 successfully with openmp 4.1.0 and saw some issues randomly with openmp 4.0.0 on the web before. I’d suggest trying 4.1.0 openmp.

I assume you mean OpenMPI.

I suggest using a modern gcc version.

The main issue is that one of the libraries you are trying to link against was compiled in such a way that it can not be linked into a shared library. Perhaps you built fftw as static library only? If so build it as shared and that may solve the issue. You can try to work around the issue it by adding -fPIC to the compiler flags (-DCMAKE_CXX_FLAGS="-fPIC").

Yep, OpenMPI

Thanks for the suggestions. I had already recompiled fftw as shared library, so that should not be a problem. I tried adding -DCMAKE_CXX_FLAGS="-fPIC". Now it goes a bit further than before, but then it returns

[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/gmx.cpp.o
[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o
[100%] Linking CXX executable …/…/bin/gmx_mpi
…/…/lib/libgromacs_mpi.a(bonded.cpp.o): In function nrnbIndex(int)': bonded.cpp:(.text+0x16cf6): undefined reference to (anonymous namespace)::c_bondedInteractionFunctions<(BondedKernelFlavor)2>’
collect2: error: ld returned 1 exit status
make[2]: *** [bin/gmx_mpi] Error 1
make[1]: *** [src/programs/CMakeFiles/gmx.dir/all] Error 2
make: *** [all] Error 2

where I left a couple more lines for context.