qsimulate-open / bagel

Brilliantly Advanced General Electronic-structure Library
GNU General Public License v3.0
92 stars 44 forks source link

Compilation error #232

Closed FreemanTheMaverick closed 2 years ago

FreemanTheMaverick commented 2 years ago

Hi. I am trying installing Bagel on the server. Intel and Boost are already installed. I followed the installation manual strictly and entered the line ../configure --enable-mkl --with-boost=$BOOST_ROOT --with-mpi=intel CXXFLAGS=-DNDEBUG --with-include="-L/opt/ohpc/pub/compiler/intel/compilers_and_libraries_2020.1.217/linux/mkl/include" But when I make, the following error appeared. /usr/include/c++/4.8.5/bits/alloc_traits.h(64): error: expression must have a constant value bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(64): note: the value of member "std::__alloctr_rebind_helper<_Alloc, _Tp>::__value [with _Alloc=std::allocator<bagel::Civector<std::complex<double>>>, _Tp=std::_Sp_counted_ptr_inplace<bagel::Civector<std::complex<double>>, std::allocator<bagel::Civector<std::complex<double>>>, __gnu_cxx::_S_atomic>]" (declared at line 57) cannot be used as a constant bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(202): error: incomplete type is not allowed using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(90): error: the global scope has no "value_type" typedef typename _Alloc::value_type value_type; ^ and many similar C++ errors. What can I do?

shiozaki commented 2 years ago

Your compiler is very old and therefore C++11 is probably not the default. Please add -std=c++11 in CXXFLAGS. If that still doesn’t work, please consider installing a newer compiler.

On Wed, Nov 10, 2021 at 11:01 PM FreemanTheMaverick < @.***> wrote:

Hi. I am trying installing Bagel on the server. Intel and Boost are already installed. I followed the installation manual strictly and entered the line ../configure --enable-mkl --with-boost=$BOOST_ROOT --with-mpi=intel CXXFLAGS=-DNDEBUG --with-include="-L/opt/ohpc/pub/compiler/intel/compilers_and_libraries_2020.1.217/linux/mkl/include" But when I make, the following error appeared. /usr/include/c++/4.8.5/bits/alloc_traits.h(64): error: expression must have a constant value bool = alloctr_rebind_helper<_Alloc, _Tp>::value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(64): note: the value of member "std::alloctr_rebind_helper<_Alloc, _Tp>::value [with _Alloc=std::allocator<bagel::Civector<std::complex>>, _Tp=std::_Sp_counted_ptr_inplace<bagel::Civector<std::complex>, std::allocator<bagel::Civector<std::complex>>, gnu_cxx::_S_atomic>]" (declared at line 57) cannot be used as a constant bool = alloctr_rebind_helper<_Alloc, _Tp>::value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(202): error: incomplete type is not allowed using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::type; ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(90): error: the global scope has no "value_type" typedef typename _Alloc::value_type value_type; ^ and many similar C++ errors. What can I do?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qsimulate-open/bagel/issues/232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDMIW7AI3KYAIBBOGD34TULM53NANCNFSM5HZQETMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

FreemanTheMaverick commented 2 years ago

Your compiler is very old and therefore C++11 is probably not the default. Please add -std=c++11 in CXXFLAGS. If that still doesn’t work, please consider installing a newer compiler. On Wed, Nov 10, 2021 at 11:01 PM FreemanTheMaverick < @.***> wrote: Hi. I am trying installing Bagel on the server. Intel and Boost are already installed. I followed the installation manual strictly and entered the line ../configure --enable-mkl --with-boost=$BOOST_ROOT --with-mpi=intel CXXFLAGS=-DNDEBUG --with-include="-L/opt/ohpc/pub/compiler/intel/compilers_and_libraries_2020.1.217/linux/mkl/include" But when I make, the following error appeared. /usr/include/c++/4.8.5/bits/alloc_traits.h(64): error: expression must have a constant value bool = alloctr_rebind_helper<_Alloc, _Tp>::value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(64): note: the value of member "std::alloctr_rebind_helper<_Alloc, _Tp>::value [with _Alloc=std::allocator<bagel::Civector<std::complex>>, _Tp=std::_Sp_counted_ptr_inplace<bagel::Civector<std::complex>, std::allocator<bagel::Civector<std::complex>>, gnu_cxx::_S_atomic>]" (declared at line 57) cannot be used as a constant bool = alloctr_rebind_helper<_Alloc, _Tp>::value> ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(202): error: incomplete type is not allowed using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::type; ^ /usr/include/c++/4.8.5/bits/alloc_traits.h(90): error: the global scope has no "value_type" typedef typename _Alloc::value_type value_type; ^ and many similar C++ errors. What can I do? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#232>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKDMIW7AI3KYAIBBOGD34TULM53NANCNFSM5HZQETMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Thank you for your timely response! Following your advice, I updated GCC to version 9.1.0. The error now becomes `/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/nvp.hpp(48): error: no instance of constructor "std::pair<_T1, _T2>::pair [with _T1=const char , _T2=int ()[3]]" matches the argument list argument types are: (const char , int ()[3]) std::pair<const char , T >(name_, boost::addressof(t)) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(436): note: this candidate was rejected because mismatch in count of arguments pair(tuple<_Args1...>&, tuple<_Args2...>&, ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(375): note: this candidate was rejected because mismatch in count of arguments pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(370): note: this candidate was rejected because mismatch in count of arguments explicit constexpr pair(pair<_U1, _U2>&& p) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(360): note: this candidate was rejected because mismatch in count of arguments constexpr pair(pair<_U1, _U2>&& p) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(350): note: this candidate was rejected because at least one template argument could not be deduced explicit constexpr pair(_U1&& x, _U2&& __y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(341): note: this candidate was rejected because at least one template argument could not be deduced constexpr pair(_U1&& x, _U2&& y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(332): note: this candidate was rejected because at least one template argument could not be deduced explicit pair(const _T1& __x, _U2&& y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(325): note: this candidate was rejected because at least one template argument could not be deduced constexpr pair(const _T1& x, _U2&& __y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(318): note: this candidate was rejected because at least one template argument could not be deduced explicit constexpr pair(_U1&& x, const _T2& y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(311): note: this candidate was rejected because at least one template argument could not be deduced constexpr pair(_U1&& __x, const _T2& y) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(304): note: this candidate was rejected because mismatch in count of arguments constexpr pair(pair&&) = default; ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(303): note: this candidate was rejected because mismatch in count of arguments constexpr pair(const pair&) = default; ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(300): note: this candidate was rejected because mismatch in count of arguments explicit constexpr pair(const pair<_U1, _U2>& p) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(291): note: this candidate was rejected because mismatch in count of arguments constexpr pair(const pair<_U1, _U2>& p) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(269): note: this candidate was rejected because at least one template argument could not be deduced explicit constexpr pair(const _T1& a, const _T2& __b) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(260): note: this candidate was rejected because at least one template argument could not be deduced constexpr pair(const _T1& a, const _T2& __b) ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(242): note: this candidate was rejected because mismatch in count of arguments explicit constexpr pair() ^ /scratch/PI/yonghuang/gcc_9.1.0/include/c++/9.1.0/bits/stl_pair.h(229): note: this candidate was rejected because mismatch in count of arguments _GLIBCXX_CONSTEXPR pair() ^ detected during: instantiation of "boost::serialization::nvp::nvp(const char , T &) [with T=int [3]]" at line 82 instantiation of "const boost::serialization::nvp boost::serialization::make_nvp(const char , T &) [with T=int [3]]" at line 41 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/array.hpp" instantiation of "void boost::serialization::serialize(Archive &, std::array<T, N> &, unsigned int) [with Archive=boost::archive::binary_iarchive, T=int, N=3UL]" at line 126 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/serialization.hpp" instantiation of "void boost::serialization::serialize_adl(Archive &, T &, unsigned int) [with Archive=boost::archive::binary_iarchive, T=std::array<int, 3UL>]" at line 191 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/archive/detail/iserializer.hpp" instantiation of "void boost::archive::detail::iserializer<Archive, T>::load_object_data(boost::archive::detail::basic_iarchive &, void *, unsigned int) const [with Archive=boost::archive::binary_iarchive, T=std::array<int, 3UL>]" at line 134 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/archive/detail/iserializer.hpp" [ 246 instantiation contexts not shown ] instantiation of "const T &boost::serialization::singleton::get_const_instance() [with T=boost::archive::detail::pointer_iserializer<boost::archive::binary_iarchive, bagel::Reference>]" at line 62 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/export.hpp" instantiation of "const boost::archive::detail::basic_pointer_iserializer &boost::archive::detail::export_impl<Archive, Serializable>::enableload(boost::mpl::true) [with Archive=boost::archive::binary_iarchive, Serializable=bagel::Reference]" at line 105 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/export.hpp" instantiation of "void boost::archive::detail::ptr_serialization_support<Archive, Serializable>::instantiate() [with Archive=boost::archive::binary_iarchive, Serializable=bagel::Reference]" at line 121 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/export.hpp" instantiation of "void boost::archive::detail::extra_detail::guid_initializer::exportguid(boost::mpl::false) const [with T=bagel::Reference]" at line 131 of "/opt/ohpc/pub/libs/intel/openmpi3/boost/1.71.0/include/boost/serialization/export.hpp" instantiation of "const boost::archive::detail::extra_detail::guid_initializer &boost::archive::detail::extra_detail::guid_initializer::export_guid() const [with T=bagel::Reference]" at line 32 of "../../../src/wfn/reference.cc"

compilation aborted for ../../../src/wfn/reference.cc (code 2) It seems that there is something wrong withstl_pair.h`.

shiozaki commented 2 years ago

This issue looks similar to me #182. It appears to me that you are using the intel compiler? I don't have access to intel compilers and therefore cannot reproduce the issue at this point.

Probably you should set I_MPI_CXX=g++ so IntelMPI uses g++ as an underlying compiler. https://www.intel.com/content/www/us/en/develop/documentation/mpi-developer-reference-windows/top/environment-variable-reference/compilation-environment-variables.html

FreemanTheMaverick commented 2 years ago

I solved this problem with this configuration setting: I_MPI_ICC=mpiicc MPICC=mpiicc I_MPI_CXX=mpigcc MPICXX=mpigcc ../configure --enable-mkl --with-boost=$BOOST_ROOT CXXFLAGS="-DNDEBUG -std=c++11 -lstdc++" --with-mpi=intel --with-boost-libdir=$BOOST_LIB --prefix=/scratch/PI/yonghuang/bagel_1.2.2 The key is setting I_MPI_CXX and MPICXX to mpigcc, which is the C++ compiler provided by Intel.