2023.3 installation chokes on MacBook pro with gcc

GROMACS version: 2023.3
GROMACS modification: No
I was happy to see the new 2023.3 release and eagerly started building it. cmake ran fine, except the expected warning about GPU detection and that OpenCL is deprecated (except on apple silicon).

When issuing make however, I got an error at 5%:

...
[  5%] Built target tng_io_zlib
[  5%] Building CXX object src/gromacs/CMakeFiles/lmfit_objlib.dir/__/external/lmfit/lmmin.cpp.o
[  5%] Built target lmfit_objlib
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParser.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserBase.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserBytecode.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserCallback.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserDLL.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserError.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserInt.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserTest.cpp.o
[  5%] Building CXX object _deps/muparser-build/CMakeFiles/muparser.dir/src/muParserTokenReader.cpp.o
[  5%] Linking CXX shared library ../../lib/libmuparser.dylib
-macosx_version_min has been renamed to -macos_version_min
ld: warning: ignoring duplicate libraries: '-lgcc'
0  0x100cc7648  __assert_rtn + 72
1  0x100bfbfac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x100c11924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x100c1ee30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x182510440  _dispatch_client_callout2 + 20
5  0x182523f1c  _dispatch_apply_invoke + 224
6  0x182510400  _dispatch_client_callout + 20
7  0x182521fb8  _dispatch_root_queue_drain + 684
8  0x1825226c0  _dispatch_worker_thread2 + 164
9  0x1826bc038  _pthread_wqthread + 228
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libmuparser.2.3.4.dylib] Error 1
make[1]: *** [_deps/muparser-build/CMakeFiles/muparser.dir/all] Error 2
make: *** [all] Error 2
BMC-7YTVT946V:build2023.3$

I use cmake 3.22.1, gcc-12 installed with Homebrew. And this is how I run cmake:

cmake -DCMAKE_INSTALL_PREFIX=$d \
      -DCMAKE_C_COMPILER=gcc-12 \
      -DCMAKE_CXX_COMPILER=g++-12 \
      -DGMX_BUILD_OWN_FFTW=ON \
      -DGMX_GPU=OpenCL \
      -DGMX_BUILD_UNITTESTS=ON \
      ../gromacs-2023.3

Any thoughts? I did almost exactly the same when installing 2023.2 and that went ok.

clang works btw. And my gcc is version 12.2.0 to be precise. The laptop is an M1 MBP.

Could you please verify that it’s specifically related to GROMACS version, and not any other changes in the environment?

The failed assertion is in ld, not in GROMACS. There are issues on recent macOS, related to GCC/linker incompatibility:

Downgrading XCode might help here.

Indeed it fails with older gromacs versions too now, so it is most likely the error that is described in those posts.