Closed rbberger closed 4 years ago
A note on the target table: while it was not the default mode, gcc=>4.8.1 and clang>=3.3 both have feature-complete -std=c++11
, so even CentOS7 should have no problem.
hello, There was a problem compiling the latest version(patch_19Mar2020 ) on MacOS(10.15.3), How should I do?
-- Running check for auto-generated files from make-based build system
-- Found OpenMP_CXX: -Xclang -fopenmp
-- Found OpenMP: TRUE
CMake Error at CMakeLists.txt:247 (message):
Cannot find required 'omp.h' header file
and LAMMPS (20 Nov 2019)
WARNING-WARNING-WARNING-WARNING-WARNING
This LAMMPS executable was compiled using C++98 compatibility.
Please report the compiler info below at https://github.com/lammps/lammps/issues/1659
Clang C++ 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)
WARNING-WARNING-WARNING-WARNING-WARNING
@yuhlzu try to build with -DBUILD_OMP=OFF
.
hello, There was a problem compiling the latest version(patch_19Mar2020 ) on MacOS(10.15.3), How should I do?
First you need to describe to use what steps exactly you did to try compile LAMMPS.
-- Running check for auto-generated files from make-based build system -- Found OpenMP_CXX: -Xclang -fopenmp -- Found OpenMP: TRUE CMake Error at CMakeLists.txt:247 (message): Cannot find required 'omp.h' header file
As far as I know, Apple's Xcode compiler distribution ships a version of Clang, that supports the OpenMP directives, but does not include the OpenMP runtime library, which is required by LAMMPS. That is why you see the error message. Your options are the following:
BTW: This has nothing to do with C++11 compatibility.
and LAMMPS (20 Nov 2019)
WARNING-WARNING-WARNING-WARNING-WARNING This LAMMPS executable was compiled using C++98 compatibility. Please report the compiler info below at https://github.com/lammps/lammps/issues/1659 Clang C++ 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8) WARNING-WARNING-WARNING-WARNING-WARNING
This is not a problem and not impacting the functionality of that LAMMPS binary. It is simply a warning, that C++-11 compatibility will soon be required and that specific compiler version did not enable it by default. C++11 is required for the 19 March 2020 version, but that version should be able to set the necessary -std=c++11
flag for your automatically.
hello, There was a problem compiling the latest version(patch_19Mar2020 ) on MacOS(10.15.3), How should I do?
First you need to describe to use what steps exactly you did to try compile LAMMPS.
-- Running check for auto-generated files from make-based build system -- Found OpenMP_CXX: -Xclang -fopenmp -- Found OpenMP: TRUE CMake Error at CMakeLists.txt:247 (message): Cannot find required 'omp.h' header file
As far as I know, Apple's Xcode compiler distribution ships a version of Clang, that supports the OpenMP directives, but does not include the OpenMP runtime library, which is required by LAMMPS. That is why you see the error message. Your options are the following:
- do not try to enable OpenMP support, or explicitly disable it. as already recommended.
- install a different compiler that does fully support OpenMP including the runtime library (e.g. via homebrew)
BTW: This has nothing to do with C++11 compatibility.
and LAMMPS (20 Nov 2019)
WARNING-WARNING-WARNING-WARNING-WARNING This LAMMPS executable was compiled using C++98 compatibility. Please report the compiler info below at https://github.com/lammps/lammps/issues/1659 Clang C++ 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8) WARNING-WARNING-WARNING-WARNING-WARNING
This is not a problem and not impacting the functionality of that LAMMPS binary. It is simply a warning, that C++-11 compatibility will soon be required and that specific compiler version did not enable it by default. C++11 is required for the 19 March 2020 version, but that version should be able to set the necessary
-std=c++11
flag for your automatically.
thank you, The error above is because I compiling lammps by cmake
cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake
now is ok when I installed gcc(c++) llvm(clang) make by brew and ln -s gcc(c++ clang make) /usr/local/bin/* , but I need to set PKG_USER-INTEL=off
I'm locking this conversation, since it has nothing to do with C++11 and this issue is closed. @yuhlzu open a new issue.
thank you, The error above is because I compiling lammps by cmake
which has nothing to do with C++11 thus you are commenting on the wrong issue.
cmake -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake -D PKG_GPU=on ../cmake
now is ok when I installed gcc(c++) llvm(clang) make by brew and ln -s gcc(c++ clang make) /usr/local/bin/* , but I need to set PKG_USER-INTEL=off
these are ugly hacks. if you do that kind of modifications to your system, then you will have to expect that things do not work, because its high probability of an inconsistent setup. it will confuse cmake. I have tested the cmake configuration in LAMMPS on an unmodified macosx system with LAMMPS patch 19 March 2020 and Xcode, and it compiles nicely. I also think that your choice of presets is not the best option. You will likely be better off using the "most" preset and then enabling selected packages.
The USER-INTEL issue is a bug in the code (actually a typo) and will be fixed in the next patch.
Summary
There is an ongoing discussion among the developers of LAMMPS about when the right time is to allow C++11 compliant code in the core of LAMMPS. Currently it is only required by some packages such as KOKKOS. But we are increasingly seeing code that needs to be changed or rejected because of the C++98 requirement.
Many compilers already default to C++14, so I would argue that by now it should be safe to move forward in allowing C++11 code in all of LAMMPS. One argument against this is usually that there are sites with older OS versions/GCC versions that enforce the use of the system compiler. It would be beneficial to collect which supercomputing sites / clusters fall into this category and what their EOL (end-of-life) is.
If you have any comments, ideas or feedback about this topic please comment below.
Proposal to assess impact
After the last LAMMPS workshop in Albuquerque (August 2019) the following was dicussed as a possible test for seeing the impact to the user base. We could include a small piece of code that will not change the behavior, but print out an error if a non-C++11 compliant compiler is used. Users that run into this error can easily disable it by defining
LAMMPS_CXX98
or switching to a C++11 compliant compiler. They should be encouraged to report here or at the mailing list so we can collect their feedback.Target Platforms
-std=c++11
)-std=c++11
)Testing default C++ compiler standard
References: