Dear Axel,
Sorry for previous email.
The version of LAMMPS is 10 Feb 2021, and the OS is MacOs big sur 11.2.1 with M1 chip.
I have tried cmake -C …/cmake/preset/clang.cmake …/cmake and minimal.cmake but all raise an error error:
**LAMMPS requires a C++11 (or later) compliant compiler. Enable C++11 compatibility or upgrade the compiler.**
Your cmake installation apparently doesn’t know how to enable C++11 compatibility on your platform. That is not a surprise, since this is a very new platform.
You can try with: cmake -C …/cmake/preset/minimal.cmake -D CMAKE_TUNE_FLAGS=-std=c++11 …/cmake
Then i try to use traditional make command. I have install mpich3, use which mpicxx echos /usr/local/bin/mpicxx, the mpicxx -v tells
mpicxx for MPICH version 3.4.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: warning: argument unused during compilation: '-I /usr/local/include' [-Wunused-command-line-argument]
but when i type sudo make mac_mpi, it prints
NEVER EVER use “sudo” to compile software. that is a very, very, VERY bad idea and can very easily destroy your OS installation.
Compiling LAMMPS for machine mac_mpi
/usr/local/bin -O3 -DLAMMPS_GZIP -DLAMMPS_JPEG -DOMPI_SKIP_MPICXX -I/opt/local/include -c …/main.cpp
make[1]: /usr/local/bin: Permission denied
make[1]: *** [main.o] Error 1
make: *** [mac_mpi] Error 2
for this output to happen, you must have modified the “mac_mpi” makefile in an incorrect way. since you don’t provide that file, it is impossible to recommend any changes.
So i have to send an email to ask how to build LAMMPS on MacOs. I am new to MacOs so I dont know how to modify it.
cmake will work correctly, if you have a cmake version that has been ported to your MacOS platform.
traditional make will work correctly, if you make correct edits.
because your sudo command may have corrupted the state of your build directory, I suggest you remove sources and everything and start over.
I already made a suggestion for how to compile with cmake that should work for your platform. if you want to go with the traditional make procedure instead, I suggest you first copy src/MAKE/Makefile.mpi to src/MAKE/MINE/ and then edit the copy to add -std=c++11 to the CCFLAGS= line near the top. this way, in case there are failures, you can always copy the original over the modified version again and try a different edit. and then try to compile a minimal version with “make mpi”, or similarly do the same with the “serial” makefile in case there is a problem with compiling/linking using your MPI installation. in either case that should get you to a minimal LAMMPS executable and then you can go on to enable the packages you need for your purposes and tune/optimize the specific compilation settings you want.
Axel.