Error compiling Gromacs 2023's checks on Mac M2

GROMACS version: 2023
GROMACS modification: No

Hi all,

I am trying to install Gromacs 2023 on my M2 MacBook Air. I am using the following compilation line:

CC=/opt/homebrew/bin/gcc-12 CXX=/opt/homebrew/bin/g++-12 cmake ../ -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs -DGMX_FFT_LIBRARY=fftw3 -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=OpenCL

The compilation seems to go smoothly, and then I issue make check. After building gmock, I get the following error:

[ 58%] Building CXX object src/testutils/CMakeFiles/testutils.dir/__/external/tinyxml2/tinyxml2.cpp.o /var/folders/nn/gdjh6s050q99zv2x7l4jy9080000gn/T//ccxOwcpn.s:20726:29: error: unexpected token in '.section' directive .section .data.rel.ro.local ^ make[3]: *** [src/testutils/CMakeFiles/testutils.dir/__/external/tinyxml2/tinyxml2.cpp.o] Error 1 make[2]: *** [src/testutils/CMakeFiles/testutils.dir/all] Error 2 make[1]: *** [CMakeFiles/check.dir/rule] Error 2 make: *** [check] Error 2

How can I fix this?

Best regards,

Marcos Verissimo Alves
Lund University

After I posted my question, I saw that another user had the same problem, also on an Apple Silicon chip (M1). Sorry for the duplicate post.

Hello!

There is a known issue of incompatibility of recent GCC with XCode linker on MacOS, see, e.g., c++ - xcode update to version 2395. ld compile problem occurs: computedAtomCount && "more atoms allocated than expected - Stack Overflow.

You can try using Clang instead of GCC, or upgrading/downgrading your XCode version.

Hi! Thank you so much for your prompt reply.

I tried upgrading my Xcode and CLI Tools to 14.2, but unfortunately the error persists. Downgrading is not an option because MacOS complains that version 13.x is too old for the current version of the OS. I wouldn’t like to use Clang because openmp parallelization is incompatible with it, only MPI. I’ll upgrade Xcode and CLI to 14.3 beta, and if it doesn’t work, then I’ll go for Clang.

I see now that I have the same issue after upgrading the operating system on my M2 MacBook Air to Venture 13.2.1 and my macports to the newest version with gcc 12.2.0.

But the issue is only in building the test and the gmx binary seems to work fine.

If you install libomp via Homebrew, it can work, perhaps with a bit of nudging along the lines of:

-DGMX_OPENMP=ON \
-DOpenMP_{C,CXX}_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" \
-DOpenMP_{C,CXX}_LIB_NAMES=omp \
-DOpenMP_omp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib

You will likely need to adjust it to the particularities of your system.

Dear Hess,

Thanks for your comment. Have you performed some tests with it? The nice thing about being able to perform the tests, I guess, is that one would be sure that no unexpected results would come by due to some weird bug due to compiler issues.

Best,

Marcos

Thank you very much for the tip! I’ll try it and post the result here.

In the end, I upgraded Xcode and CLI to 14.3 beta, but unfortunately the error persisted.