Compilation error: Intel Compilers and GCC 12

When building the latest stable release (Update 3 for Stable release 29 September 2021) with the latest Intel compilers on a machine with the latest GCC, the build fails at this point:

[ 59%] Building CXX object CMakeFiles/lammps.dir/home/user1/Applications/PKG_LMP/src/lammps/src/math_eigen.cpp.o
In file included from /usr/include/c++/12.1.0/random(49),
                 from /home/user1/Applications/PKG_LMP/src/lammps/src/math_eigen_impl.h(50),
                 from /home/user1/Applications/PKG_LMP/src/lammps/src/math_eigen.cpp(20):
/usr/include/c++/12.1.0/bits/random.h(104): error: expected a declaration
        { __extension__ using type = unsigned __int128; };
                        ^

This is not a LAMMPS issue but a compatibility problem between your Intel and GCC compilers.

1 Like

Thanks! I fixed it by installing v11 of GCC and then using the following:

 export GXX_INCLUDE=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/c++/
-D CMAKE_C_FLAGS= -gcc-name=gcc-11
-D CMAKE_CXX_FLAGS= -gxx-name=g++-11