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

v4.1.3: error: ‘value’ is not a member of ‘typex’ #3864

Closed
junghans opened this issue Aug 17, 2020 · 6 comments
Closed

v4.1.3: error: ‘value’ is not a member of ‘typex’ #3864

junghans opened this issue Aug 17, 2020 · 6 comments
Assignees

Comments

@junghans
Copy link
Member

[ 35%] Building CXX object src/core/CMakeFiles/EspressoCore.dir/nonbonded_interactions/ljcos2.cpp.o
cd /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso-4.1.3_build/src/core && /usr/bin/x86_64-pc-linux-gnu-g++ -DEspressoCore_EXPORTS -DR123_USE_MULHILO64_C99 -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/SYSTEM -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/config -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso-4.1.3_build/src/config -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/utils/include -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/profiler/include -I/var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/pdbparser/include -isystem /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/libs/Random123-1.09/include  -O2 -pipe -march=native -frecord-gcc-switches -Wall -Wextra -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -Wno-missing-braces -Wno-implicit-fallthrough -Wno-clobbered -Wno-cast-function-type -pedantic -fPIC -pthread -std=c++14 -o CMakeFiles/EspressoCore.dir/nonbonded_interactions/ljcos2.cpp.o -c /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/nonbonded_interactions/ljcos2.cpp
In file included from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/grid_based_algorithms/lb_particle_coupling.hpp:24,
                 from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/grid_based_algorithms/lb_particle_coupling.cpp:19:
/usr/include/boost/serialization/optional.hpp:98:8: error: ‘version’ is not a class template
   98 | struct version<boost::optional<T> > {
      |        ^~~~~~~
In file included from /usr/include/boost/archive/detail/oserializer.hpp:54,
                 from /usr/include/boost/mpi/detail/mpi_datatype_oarchive.hpp:14,
                 from /usr/include/boost/mpi/detail/mpi_datatype_cache.hpp:13,
                 from /usr/include/boost/mpi/datatype.hpp:27,
                 from /usr/include/boost/mpi/communicator.hpp:22,
                 from /usr/include/boost/mpi/inplace.hpp:17,
                 from /usr/include/boost/mpi/collectives/all_reduce.hpp:17,
                 from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/MpiCallbacks.hpp:30,
                 from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/communication.hpp:52,
                 from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/grid_based_algorithms/lb_particle_coupling.cpp:21:
/usr/include/boost/serialization/version.hpp:36:8: error: redefinition of ‘struct boost::serialization::version<T>’
   36 | struct version
      |        ^~~~~~~
In file included from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/grid_based_algorithms/lb_particle_coupling.hpp:24,
                 from /var/tmp/portage/sci-physics/espresso-4.1.3/work/espresso/src/core/grid_based_algorithms/lb_particle_coupling.cpp:19:
/usr/include/boost/serialization/optional.hpp:98:8: note: previous definition of ‘struct boost::serialization::version<T>’
   98 | struct version<boost::optional<T> > {
      |        ^~~~~~~

build log

Upstream Bug in Gentoo: https://bugs.gentoo.org/737534

@jngrad jngrad self-assigned this Aug 17, 2020
@jngrad
Copy link
Member

jngrad commented Aug 17, 2020

That's an issue from boost 1.74. Reproducible in Fedora 32 with boost 1.74 compiled from sources (dockerfile). Also happens on espresso 4.2-dev, although only in src/utils/tests/memcpy_archive_test.cpp. I'm opening a ticket on their repository.


Here is a MWE for the first bug:

#include <boost/serialization/optional.hpp>
int main () {
  return 0;
}
c++ -isystem /opt/boost/include -std=c++14 -c a.cpp
In file included from a.cpp:1:
/opt/boost/include/boost/serialization/optional.hpp:98:8: error: ‘version’ is not a class template
   98 | struct version<boost::optional<T> > {
      |        ^~~~~~~

Here is a MWE for the interaction with boost::mpi (the order of the include statements is important):

#include <boost/serialization/optional.hpp>
#include <boost/mpi/communicator.hpp>
int main () {
  return 0;
}
c++ -isystem /opt/boost/include -std=c++14 -c b.cpp
[truncated log output]
In file included from /opt/boost/include/boost/optional/optional.hpp:33,
                 from /opt/boost/include/boost/optional.hpp:15,
                 from /opt/boost/include/boost/serialization/optional.hpp:19,
                 from b.cpp:1:
/opt/boost/include/boost/archive/detail/check.hpp: In instantiation of ‘void boost::archive::detail::check_object_versioning() [with T = std::__cxx11::basic_string<char>]’:
/opt/boost/include/boost/archive/detail/iserializer.hpp:459:37:   required from ‘static void boost::archive::detail::load_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = std::__cxx11::basic_string<char>; Archive = boost::mpi::packed_iarchive]’
/opt/boost/include/boost/archive/detail/iserializer.hpp:624:18:   required from ‘void boost::archive::load(Archive&, T&) [with Archive = boost::mpi::packed_iarchive; T = std::__cxx11::basic_string<char>]’
/opt/boost/include/boost/archive/detail/common_iarchive.hpp:67:22:   required from ‘void boost::archive::detail::common_iarchive<Archive>::load_override(T&) [with T = std::__cxx11::basic_string<char>; Archive = boost::mpi::packed_iarchive]’
/opt/boost/include/boost/mpi/packed_iarchive.hpp:99:69:   required from ‘void boost::mpi::packed_iarchive::load_override(T&, mpl_::false_) [with T = std::__cxx11::basic_string<char>; mpl_::false_ = mpl_::bool_<false>]’
/opt/boost/include/boost/mpi/packed_iarchive.hpp:116:18:   required from ‘void boost::mpi::packed_iarchive::load_override(T&) [with T = std::__cxx11::basic_string<char>]’
/opt/boost/include/boost/archive/detail/interface_iarchive.hpp:68:36:   required from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = std::__cxx11::basic_string<char>; Archive = boost::mpi::packed_iarchive]’
/opt/boost/include/boost/mpi/packed_iarchive.hpp:142:23:   required from here
/opt/boost/include/boost/archive/detail/check.hpp:78:5: error: ‘value’ is not a member of ‘typex’ {aka ‘boost::mpl::or_<boost::mpl::greater<boost::serialization::implementation_level<std::__cxx11::basic_string<char> >, mpl_::int_<2> >, boost::mpl::equal_to<boost::serialization::version<std::__cxx11::basic_string<char> >, mpl_::int_<0> >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >’}
   78 |     BOOST_STATIC_ASSERT(typex::value);
      |     ^~~~~~~~~~~~~~~~~~~

@junghans
Copy link
Member Author

Thanks for the update.

@junghans
Copy link
Member Author

junghans commented Sep 8, 2020

This issue now happens on openSUSE as well. @dirkmueller, can we patch boostorg/serialization#217 into tumbleweed?

@jngrad
Copy link
Member

jngrad commented Oct 29, 2020

@junghans To solve the issue on 4.1.3 and 4.1.4, you can adapt the patch in a392907, i.e.:

diff --git a/src/core/grid_based_algorithms/lb_particle_coupling.hpp b/src/core/grid_based_algorithms/lb_particle_coupling.hpp
index de12cb4..13111ab 100644
--- a/src/core/grid_based_algorithms/lb_particle_coupling.hpp
+++ b/src/core/grid_based_algorithms/lb_particle_coupling.hpp
@@ -21,6 +21,15 @@
 
 #include "ParticleRange.hpp"
 
+/* This <boost/serialization/version.hpp> include guards against an issue
+ * in boost::serialization from boost 1.74.0 that leads to compiler error
+ * "explicit specialization of undeclared template struct 'version'" when
+ * including <boost/serialization/optional.hpp>. More details in tickets:
+ * https://github.com/boostorg/serialization/issues/210
+ * https://github.com/boostorg/serialization/issues/217
+ */
+#include <boost/serialization/version.hpp>
+
 #include <boost/serialization/optional.hpp>
 
 #include "ParticleRange.hpp"

Tested in a Fedora 33 docker container with boost 1.74 compiled from sources.

@junghans
Copy link
Member Author

junghans commented Oct 29, 2020

Thanks, will use that patch on openSUSE.

@jngrad
Copy link
Member

jngrad commented Nov 2, 2020

Issue fixed in 4.2.0 and patched in the OpenSUSE package (request 844905). Closing.

@jngrad jngrad closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants