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.
hess
March 8, 2023, 11:01am
5
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.
Thank you for your suggestion. I had the same problem that produced the error: unexpected token in '.section' directive .section .data.rel.ro.local
when running make check
Your suggestion of using Homebrew to install libomp
worked fine for me–I got OpenMP support using Apple’s clang compilers. I also had previously installed llvm
using Homebrew.
I did get some warning during make
:
warning: 'sprintf' is deprecated:
it is highly recommended that you use snprintf(3) instead.
I saw this post that says to ignore the warnings.
Details:
System:
OS X 13.4 Ventura
Apple M2 Pro
16 GB Memory
gcc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
g++ --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
cd build
export LDFLAGS="-L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/llvm/include"
cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DGMX_FFT_LIBRARY=fftw3 -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -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
make
make check
100% tests passed, 0 tests failed out of 87
# woo hoo!
sudo make install
source /usr/local/gromacs/bin/GMXRC
gmx --version
:-) GROMACS - gmx, 2023.2 (-:
Executable: /usr/local/gromacs/bin/gmx
Data prefix: /usr/local/gromacs
Working dir: /Users/davidoppenheimer/Downloads/gromacs-2023.2/build
Command line:
gmx --version
GROMACS version: 2023.2
Precision: mixed
Memory model: 64 bit
MPI library: thread_mpi
OpenMP support: enabled (GMX_OPENMP_MAX_THREADS = 128)
GPU support: disabled
SIMD instructions: ARM_NEON_ASIMD
CPU FFT library: fftw-3.3.8
GPU FFT library: none
Multi-GPU FFT: none
TNG support: enabled
Hwloc support: disabled
Tracing support: disabled
C compiler: /usr/bin/gcc AppleClang 14.0.3.14030022
C compiler flags: -Wno-missing-field-initializers -fno-stack-check -fno-stack-check -O3 -DNDEBUG
C++ compiler: /usr/bin/g++ AppleClang 14.0.3.14030022
C++ compiler flags: -Wno-reserved-identifier -Wno-missing-field-initializers -fno-stack-check -fno-stack-check -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-source-uses-openmp -Wno-c++17-extensions -Wno-documentation-unknown-command -Wno-covered-switch-default -Wno-switch-enum -Wno-extra-semi-stmt -Wno-weak-vtables -Wno-shadow -Wno-padded -Wno-reserved-id-macro -Wno-double-promotion -Wno-exit-time-destructors -Wno-global-constructors -Wno-documentation -Wno-format-nonliteral -Wno-used-but-marked-unused -Wno-float-equal -Wno-conditional-uninitialized -Wno-conversion -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-unsafe-buffer-usage -Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include -O3 -DNDEBUG
BLAS library: External - detected on the system
LAPACK library: External - detected on the system