Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error -- Cantera 2.6.0 #1277

Closed
fbisetti opened this issue May 6, 2022 · 9 comments
Closed

Build error -- Cantera 2.6.0 #1277

fbisetti opened this issue May 6, 2022 · 9 comments

Comments

@fbisetti
Copy link

fbisetti commented May 6, 2022

Problem description

Compile error when building Cantera 2.6.0

Steps to reproduce

  1. Scons call
scons build \
        prefix="/apps/cantera/gcc-system/2.6.0" \
        sundials_include="/apps/sundials/gcc/system/openmpi-2.1.0/5.1.0/include" \
        sundials_libdir="/apps/sundials/gcc/system/openmpi-2.1.0/5.1.0/lib" \
        optimize='yes' \
        optimize_flags='-O3 -Wno-inline' \
        python_package='none' \
        system_eigen='n'
  1. Fails with...
scons: Reading SConscript files ...
INFO: SCons 4.2.0 is using the following Python interpreter:
/home/fbisetti/opt/Python-3.9.9/bin/python3 (Python 3.9)
INFO: Building Cantera from git commit '9573e6b'
INFO: Configuration variables read from 'cantera.conf' and command line:
    prefix = '/apps/cantera/gcc-system/2.6.0'
    python_package = 'none'
    system_eigen = 'n'
    sundials_include = '/apps/sundials/gcc/system/openmpi-2.1.0/5.1.0/include'
    sundials_libdir = '/apps/sundials/gcc/system/openmpi-2.1.0/5.1.0/lib'

Checking for C++ header file cmath... (cached) yes
Checking for C++ header file fmt/ostream.h... (cached) no
INFO: Using private installation of fmt library.
INFO: Found fmt version 6.2.1
Checking for YAML::Node().Mark()... (cached) no
INFO: Using private installation of yaml-cpp library.
Checking for C++ header file gtest/gtest.h... (cached) no
Checking for C++ header file gmock/gmock.h... (cached) no
INFO: Using Googletest from Git submodule
INFO: Using private installation of Eigen.
INFO: Found Eigen version 
Checking whether __GLIBCXX__ is declared... (cached) yes
Checking whether __clang__ is declared... (cached) no
Checking for C++ library iomp5... (cached) no
Checking for C++ library omp... (cached) no
Checking for C++ library gomp... (cached) yes
INFO: Found Boost version 1.53
Checking whether boost::core::demangle is declared... (cached) no
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... (cached) no
Checking for CVodeCreate(CV_BDF) in C++ library sundials_cvodes... (cached) yes
Checking for double x; log(x) in C library None... (cached) no
INFO: Using system installation of Sundials version 5.1.0.
Checking whether SUNDIALS_BLAS_LAPACK is declared... (cached) no
INFO: Using 'gfortran' to build the Fortran 90 interface
scons: done reading SConscript files.
scons: Building targets ...
ConfigBuilder(["build/src/config.h.build"], ["include/cantera/base/config.h.in"])
INFO: Generating build/src/config.h.build with the following settings:
    CANTERA_SHORT_VERSION               "2.6"
    CANTERA_VERSION                     "2.6.0"
    CT_LEGACY_RATE_CONSTANTS            1
    CT_SUNDIALS_USE_LAPACK              0
    CT_SUNDIALS_VERSION                 51
    FTN_TRAILING_UNDERSCORE             1
    LAPACK_FTN_STRING_LEN_AT_END        1
    LAPACK_FTN_TRAILING_UNDERSCORE      1
    LAPACK_NAMES_LOWERCASE              1
    CT_NO_LEGACY_REACTIONS_26           *undefined*
    CT_USE_DEMANGLE                     *undefined*
    CT_USE_LAPACK                       *undefined*
    CT_USE_SYSTEM_EIGEN                 *undefined*
    CT_USE_SYSTEM_EIGEN_PREFIXED        *undefined*
    CT_USE_SYSTEM_FMT                   *undefined*
    CT_USE_SYSTEM_YAMLCPP               *undefined*
    DARWIN                              *undefined*
    SOLARIS                             *undefined*
g++ -o build/src/zeroD/ReactorFactory.os -c -std=c++11 -pthread -O3 -Wno-inline -g -Wall -include src/pch/system.h -fPIC -DNDEBUG -Iinclude -Iinclude/cantera/ext -Ibuild/src -I/apps/sundials/gcc/system/openmpi-2.1.0/5.1.0/include src/zeroD/ReactorFactory.cpp
In file included from src/zeroD/ReactorFactory.cpp:8:0:
include/cantera/zeroD/ReactorDelegator.h: In instantiation of 'Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]::__lambda12':
include/cantera/zeroD/ReactorDelegator.h:69:14:   required from 'struct Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]::__lambda12'
include/cantera/zeroD/ReactorDelegator.h:68:9:   required from 'Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]'
src/zeroD/ReactorFactory.cpp:32:74:   required from here
include/cantera/zeroD/Reactor.h:202:18: error: 'virtual void Cantera::Reactor::updateSurfaceState(double*)' is protected
     virtual void updateSurfaceState(double* y);
                  ^
In file included from src/zeroD/ReactorFactory.cpp:13:0:
include/cantera/zeroD/ReactorDelegator.h:69:85: error: within this context
             [this](std::array<size_t, 1> sizes, double* y) { R::updateSurfaceState(y); });
                                                                                     ^
In file included from /usr/include/c++/4.8.2/bits/stl_algo.h:66:0,
                 from /usr/include/c++/4.8.2/algorithm:62,
                 from src/pch/system.h:13:
/usr/include/c++/4.8.2/functional: In substitution of 'template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]::__lambda13; _Res = void; _ArgTypes = {std::array<long unsigned int, 1ul>, double*}]':
/usr/include/c++/4.8.2/functional:2257:9:   required from 'Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]'
src/zeroD/ReactorFactory.cpp:32:74:   required from here
/usr/include/c++/4.8.2/functional:2181:71: error: use of 'Cantera::ReactorDelegator<R>::ReactorDelegator() [with R = Cantera::Reactor]::__lambda13' before deduction of 'auto'
  using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
                                                                       ^
/usr/include/c++/4.8.2/functional:2257: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccYjzlZ8.out file, please attach this to your bugreport.
scons: *** [build/src/zeroD/ReactorFactory.os] Error 1
scons: building terminated because of errors.

System information

  • Cantera version: 2.6.0 commit 9573e6b
  • OS: Linux vulcan.ae.utexas.edu 3.10.0-514.el7.x86_64 Phase models incompete #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Python: Python 3.9.9
  • Compiler: g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
@fbisetti fbisetti changed the title Compile error Build error -- Cantera 2.6.0 May 6, 2022
@ischoegl
Copy link
Member

ischoegl commented May 6, 2022

Hi @fbisetti ... thanks for the report. This looks like a RHEL 7 system, where tools are relatively dated (GCC 4.8.5 is from 2015, boost 1.53.0 is from 2013; likewise, yamlcpp doesn't include some newer features). The compilation error reported above shows up in a reactor type introduced in Cantera 2.6, but hasn't appeared in any of the other environments we're testing. As a work-around, do you have any alternative compilers on your environment? (e.g. Intel OneAPI)

@fbisetti
Copy link
Author

fbisetti commented May 6, 2022

Thanks Ingmar. You are correct that the tools are dated. We'll try again with gcc (GCC) 8.2.0 and supporting stack.

@fbisetti
Copy link
Author

fbisetti commented May 6, 2022

I've built 2.6.0 successfully using gcc 8.2.0. I also pointed scons to a new Sundials v6.2.0 installation with the same gcc stack. During build there were a handful of deprecated calls to Sundials (maybe Sundials 6.2.0 is head of Cantera 2.6.0?).

scons test returned Tests passed: 490 Up-to-date tests skipped: 0 Tests failed: 0 so I guess all is good.

@fbisetti fbisetti closed this as completed May 6, 2022
@ischoegl
Copy link
Member

ischoegl commented May 6, 2022

Ciao Fabrizio, happy it worked! Also good to hear that SUNDIALS 6.2 didn’t cause issues as it’s not something we’re testing against yet.

PS: tagging Cantera/enhancements#152 and Cantera/enhancements#148

@fbisetti
Copy link
Author

fbisetti commented May 6, 2022

sundials_6.2.0.log

These are the only warnings thrown around Sundials 6.2.0. Hope this helps.

@speth
Copy link
Member

speth commented May 7, 2022

The accepted answer in this StackOverflow post suggests that this error message is due to a bug in that version of GCC that has clearly been fixed in more recent versions.

@speth
Copy link
Member

speth commented May 8, 2022

This compiler error is only the tip of the iceberg for problems with GCC 4.8. The compiler error above can be worked around by running scons build with the additional option cxx_flags='-std=c++11 -fno-access-control'. However, just about every test will fail because we started using std::regex (in #1076), which wasn't actually implemented until GCC 4.9.

Compiling with GCC 4.9 still fails with the (incorrect) error about Cantera::Reactor::updateSurfaceState being inaccessible, unless the -fno-access-control option is specified, but after that it is able to pass the full test suite.

Compiling Cantera 2.6.0 with GCC 5.4.0 (available on Ubuntu 16.04) works without any modifications, so I'm inclined to update our list of known/expected supported versions to make this our minimum. I don't think it's worth the extra effort to try testing the earlier releases in the 5.x series.

@santoshshanbhogue
Copy link
Contributor

Two weeks ago I tried to compile on CentOS with gcc 4.8.5, and using Sundials that ships with Cantera. I did not get the Sundials error (maybe scons did not get to that point), but it had an issue with BOOST (my boost version is 1.79)

I was able to build/test/install fine with gcc 9.2.0. Just relaying this here, in case it helps:

g++ -o build/src/thermo/PengRobinson.os -c -std=c++11 -pthread -O3 -Wno-inline -g -Wall -include src/pch/system.h -fPIC -DNDEBUG -Iinclude -Iinclude/cantera/ext -Ibuild/src -I/home/santosh1/.conda/envs/default/include -I/home/santosh1/packages/boost src/thermo/PengRobinson.cpp In file included from /home/santosh1/packages/boost/boost/config.hpp:61:0, from /home/santosh1/packages/boost/boost/algorithm/string/std_containers_traits.hpp:18, from /home/santosh1/packages/boost/boost/algorithm/string.hpp:18, from src/pch/system.h:16: /home/santosh1/packages/boost/boost/math/tools/precision.hpp:41:83: error: redeclaration 'int boost::math::tools::digits()' differs in 'constexpr' inline BOOST_MATH_CONSTEXPR int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_NOEXCEPT ^ In file included from /home/santosh1/packages/boost/boost/math/special_functions/math_fwd.hpp:31:0, from /home/santosh1/packages/boost/boost/math/special_functions/sign.hpp:17, from /home/santosh1/packages/boost/boost/math/tools/roots.hpp:22, from src/thermo/PengRobinson.cpp:12: /home/santosh1/packages/boost/boost/math/policies/policy.hpp:25:15: error: from previous declaration 'constexpr int boost::math::tools::digits()' constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept; ^ In file included from /home/santosh1/packages/boost/boost/math/tools/roots.hpp:18:0, from src/thermo/PengRobinson.cpp:12: /home/santosh1/packages/boost/boost/math/tools/config.hpp:261:77: error: redeclaration 'T boost::math::tools::epsilon()' differs in 'constexpr' # define BOOST_MATH_NOEXCEPT(T) noexcept(boost::is_floating_point::value) ^ /home/santosh1/packages/boost/boost/math/tools/precision.hpp:246:82: note: in expansion of macro 'BOOST_MATH_NOEXCEPT' inline BOOST_MATH_CONSTEXPR T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T) ^ In file included from /home/santosh1/packages/boost/boost/math/special_functions/math_fwd.hpp:31:0, from /home/santosh1/packages/boost/boost/math/special_functions/sign.hpp:17, from /home/santosh1/packages/boost/boost/math/tools/roots.hpp:22, from src/thermo/PengRobinson.cpp:12: /home/santosh1/packages/boost/boost/math/policies/policy.hpp:27:13: error: from previous declaration 'constexpr T boost::math::tools::epsilon()' constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point::value); ^ /home/santosh1/packages/boost/boost/math/policies/policy.hpp:27:13: warning: inline function 'constexpr T boost::math::tools::epsilon() [with T = double]' used but never defined [enabled by default] scons: *** [build/src/thermo/PengRobinson.os] Error 1 scons: building terminated because of errors.

@fbisetti
Copy link
Author

Thanks to all for your help and support. It is obvious that Cantera has established itself as the de-facto kinetics library thanks to all of the active developers and maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants