qcscine / sparrow

https://scine.ethz.ch
BSD 3-Clause "New" or "Revised" License
78 stars 15 forks source link

Compilation fails with GCC 11 #8

Closed awvwgk closed 2 years ago

awvwgk commented 2 years ago

Configured Sparrow 3.0.0 with

❯ cmake -B _build -G Ninja -DSCINE_MARCH="" -DCMAKE_INSTALL_PREFIX=$PWD/PREFIX
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: system filesystem 
-- Found GTest locally at: GTest::gtest
-- Scine::Core was not found in your PATH, so it was downloaded.
-- yaml-cpp was not found in your PATH, so it was downloaded.
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found suitable version "1.78.0", minimum required is "1.58.0")  
-- Eigen3 version: 3.4.0
-- IRC was not found in your PATH, so it was downloaded.
-- Found MKL: /opt/intel/mkl/include  
-- Found Intel MKL libraries:
-- /opt/intel/mkl/include 
-- /opt/intel/mkl/lib/intel64/libmkl_avx2.so 
-- /opt/intel/mkl/lib/intel64/libmkl_vml_avx2.so 
-- /opt/intel/mkl/lib/intel64/libmkl_core.so 
-- /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so 
-- /opt/intel/mkl/lib/intel64/libmkl_gnu_thread.so 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found MKL for use with Eigen3
-- Found GTest locally at: GTest::gtest
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: filesystem system 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Scine::UtilsOS was not found in your PATH, so it was downloaded.
CMake Deprecation Warning at _build/cereal-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at _build/cereal-src/CMakeLists.txt:2 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Cereal was not found in your PATH, so it was downloaded.
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: program_options filesystem 
-- Found GTest locally at: GTest::gtest
-- Found PythonInterp: /usr/bin/python (found version "3.10.1") 
-- Cereal found locally at cereal_DIR-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/awvwgk/projects/src/git/scine/sparrow/_build

using GCC 11

❯ c++ --version
c++ (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compilation fails with due to std::transform and std::all_of in NddoParamters:

[467/485] Building CXX object src/Sparrow/Embed/CMakeFiles/Embed.dir/NddoParameters.cpp.o
FAILED: src/Sparrow/Embed/CMakeFiles/Embed.dir/NddoParameters.cpp.o 
/usr/bin/c++ -DBOOST_ALL_DYN_LINK -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DEIGEN_USE_MKL_ALL -I/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed -I/home/awvwgk/projects/src/git/scine/sparrow/_build/src/Sparrow -I/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow -I/home/awvwgk/projects/src/git/scine/sparrow/_build/scine-utils-os-src/src/Utils -I/opt/intel/mkl/include -I/home/awvwgk/projects/src/git/scine/sparrow/_build/scine-core-src/src/Core -I/home/awvwgk/projects/src/git/scine/sparrow/_build/cereal-src/include -isystem /usr/include/eigen3 -Wall -Wextra -Wpedantic -O2 -g -DNDEBUG -fopenmp -std=gnu++14 -MD -MT src/Sparrow/Embed/CMakeFiles/Embed.dir/NddoParameters.cpp.o -MF src/Sparrow/Embed/CMakeFiles/Embed.dir/NddoParameters.cpp.o.d -o src/Sparrow/Embed/CMakeFiles/Embed.dir/NddoParameters.cpp.o -c /home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/NddoParameters.cpp
In file included from /home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/NddoParameters.cpp:8:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h: In function ‘std::string lower(std::string)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h:102:8: error: ‘transform’ is not a member of ‘std’
  102 |   std::transform(std::begin(a), std::end(a), std::begin(a), [](unsigned char c) { return std::tolower(c); });
      |        ^~~~~~~~~
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h: In function ‘std::string upper(std::string)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h:107:8: error: ‘transform’ is not a member of ‘std’
  107 |   std::transform(std::begin(a), std::end(a), std::begin(a), [](unsigned char c) { return std::toupper(c); });
      |        ^~~~~~~~~

and DftbParameterSet:

[469/485] Building CXX object src/Sparrow/Embed/CMakeFiles/Embed.dir/DftbParameterSet.cpp.o
FAILED: src/Sparrow/Embed/CMakeFiles/Embed.dir/DftbParameterSet.cpp.o 
/usr/bin/c++ -DBOOST_ALL_DYN_LINK -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DEIGEN_USE_MKL_ALL -I/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed -I/home/awvwgk/projects/src/git/scine/sparrow/_build/src/Sparrow -I/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow -I/home/awvwgk/projects/src/git/scine/sparrow/_build/scine-utils-os-src/src/Utils -I/opt/intel/mkl/include -I/home/awvwgk/projects/src/git/scine/sparrow/_build/scine-core-src/src/Core -I/home/awvwgk/projects/src/git/scine/sparrow/_build/cereal-src/include -isystem /usr/include/eigen3 -Wall -Wextra -Wpedantic -O2 -g -DNDEBUG -fopenmp -std=gnu++14 -MD -MT src/Sparrow/Embed/CMakeFiles/Embed.dir/DftbParameterSet.cpp.o -MF src/Sparrow/Embed/CMakeFiles/Embed.dir/DftbParameterSet.cpp.o.d -o src/Sparrow/Embed/CMakeFiles/Embed.dir/DftbParameterSet.cpp.o -c /home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp
In file included from /home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp:8:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h: In function ‘std::string lower(std::string)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h:102:8: error: ‘transform’ is not a member of ‘std’
  102 |   std::transform(std::begin(a), std::end(a), std::begin(a), [](unsigned char c) { return std::tolower(c); });
      |        ^~~~~~~~~
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h: In function ‘std::string upper(std::string)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/Common.h:107:8: error: ‘transform’ is not a member of ‘std’
  107 |   std::transform(std::begin(a), std::end(a), std::begin(a), [](unsigned char c) { return std::toupper(c); });
      |        ^~~~~~~~~
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp: In function ‘std::string {anonymous}::setIdentifier(std::string)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp:50:8: error: ‘transform’ is not a member of ‘std’
   50 |   std::transform(std::begin(a), std::end(a), std::begin(a), [](const char x) {
      |        ^~~~~~~~~
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp: In function ‘std::ostream& {anonymous}::operator<<(std::ostream&, const Indented<std::array<std::vector<double>, 28> >&)’:
/home/awvwgk/projects/src/git/scine/sparrow/src/Sparrow/Embed/DftbParameterSet.cpp:88:14: error: ‘all_of’ is not a member of ‘std’
   88 |     if (std::all_of(std::begin(col), std::end(col), [](const double v) { return v == 0.0; })) {
      |              ^~~~~~
weymutht commented 2 years ago

Thanks a lot for reporting this! You could try two things:

(Actually, we will set the C++ standard to C++17 in the next release, see also this issue.)

reiher-research-group commented 2 years ago

This is fixed in version 4.0.0 of ReaDuct which has been released today.