compilation failing with xml serialization

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

compilation failing with xml serialization

#1 Post by Dilvish »

trying to compile with xml serialization specified in util/Serialize.h is now failing for me; compiling with binary serialization is working fine. Compilation with xml serialization works fine at least up to 6283; compilation is then failing for me at a later stage for various other reasons until 6293, at which point I get an early fail related to xml serialization. A build log is below.

Code: Select all

/home/FO/Downloads/freeorion_head/FreeOrion> make
[  7%] Built target log4cpp
[  7%] Building CXX object CMakeFiles/freeorioncommon.dir/network/Message.cpp.o
In file included from /usr/local/include/boost/archive/xml_iarchive.hpp:24:0,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/../util/Serialize.h:14,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:16:
/usr/local/include/boost/archive/basic_xml_iarchive.hpp: In instantiation of ‘void boost::archive::basic_xml_iarchive<Archive>::load_override(T&, int) [with T = boost::shared_ptr<System>; Archive = boost::archive::xml_iarchive]’:
/usr/local/include/boost/archive/xml_iarchive.hpp:93:9:   required from ‘void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = boost::shared_ptr<System>; Archive = boost::archive::xml_iarchive]’
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:60:9:   required from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = boost::shared_ptr<System>; Archive = boost::archive::xml_iarchive]’
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:67:35:   required from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator&(T&) [with T = boost::shared_ptr<System>; Archive = boost::archive::xml_iarchive]’
/home/FO/Downloads/freeorion_head/FreeOrion/network/../combat/../universe/TemporaryPtr.h:90:7:   required from ‘void TemporaryPtr<T>::serialize(Archive&, unsigned int) [with Archive = boost::archive::xml_iarchive; T = System]’
/usr/local/include/boost/serialization/access.hpp:118:9:   required from ‘static void boost::serialization::access::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::xml_iarchive; T = TemporaryPtr<System>]’
/usr/local/include/boost/serialization/serialization.hpp:69:5:   [ skipping 6 instantiation contexts ]
/usr/local/include/boost/archive/detail/iserializer.hpp:592:5:   required from ‘void boost::archive::load(Archive&, T&) [with Archive = boost::archive::xml_iarchive; T = TemporaryPtr<System>]’
/usr/local/include/boost/archive/detail/common_iarchive.hpp:66:9:   required from ‘void boost::archive::detail::common_iarchive<Archive>::load_override(T&, int) [with T = TemporaryPtr<System>; Archive = boost::archive::xml_iarchive]’
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:86:9:   required from ‘void boost::archive::basic_xml_iarchive<Archive>::load_override(const boost::serialization::nvp<T>&, int) [with T = TemporaryPtr<System>; Archive = boost::archive::xml_iarchive]’
/usr/local/include/boost/archive/xml_iarchive.hpp:93:9:   required from ‘void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = const boost::serialization::nvp<TemporaryPtr<System> >; Archive = boost::archive::xml_iarchive]’
/usr/local/include/boost/archive/detail/interface_iarchive.hpp:60:9:   required from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = const boost::serialization::nvp<TemporaryPtr<System> >; Archive = boost::archive::xml_iarchive]’
/home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:1022:15:   required from here
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<boost::shared_ptr<System> >::************)’
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: note: candidate is:
In file included from /usr/local/include/boost/mpl/aux_/na_assert.hpp:23:0,
                 from /usr/local/include/boost/mpl/arg.hpp:25,
                 from /usr/local/include/boost/mpl/placeholders.hpp:24,
                 from /usr/local/include/boost/iterator/iterator_categories.hpp:17,
                 from /usr/local/include/boost/iterator/detail/facade_iterator_category.hpp:7,
                 from /usr/local/include/boost/iterator/iterator_facade.hpp:14,
                 from /usr/local/include/boost/signals/detail/named_slot_map.hpp:19,
                 from /usr/local/include/boost/signals/detail/signal_base.hpp:15,
                 from /usr/local/include/boost/signals/signal_template.hpp:23,
                 from /usr/local/include/boost/signals/signal0.hpp:24,
                 from /usr/local/include/boost/signal.hpp:19,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/../combat/../universe/Universe.h:9,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/../combat/CombatSystem.h:5,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/../combat/CombatLogManager.h:5,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:5:
/usr/local/include/boost/mpl/assert.hpp:79:5: note: template<bool C> int mpl_::assertion_failed(typename mpl_::assert<C>::type)
/usr/local/include/boost/mpl/assert.hpp:79:5: note:   template argument deduction/substitution failed:
In file included from /usr/local/include/boost/archive/xml_iarchive.hpp:24:0,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/../util/Serialize.h:14,
                 from /home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:16:
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: note:   cannot convert ‘mpl_::assert_arg<boost::serialization::is_wrapper<boost::shared_ptr<System> > >(0u, 1)’ (type ‘mpl_::failed************ boost::serialization::is_wrapper<boost::shared_ptr<System> >::************’) to type ‘mpl_::assert<false>::type {aka mpl_::assert<false>}’
make[2]: *** [CMakeFiles/freeorioncommon.dir/network/Message.cpp.o] Error 1
make[1]: *** [CMakeFiles/freeorioncommon.dir/all] Error 2
make: *** [all] Error 2
*** Failure: Exit code 2 ***
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: compilation failing with xml serialization

#2 Post by adrian_broher »

/home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:1022:15: required from here
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<boost::shared_ptr<System> >::************)’
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: note: candidate is:
Boost serialization doesn't understand how to serialize a TemporaryPtr.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: compilation failing with xml serialization

#3 Post by Bigjoe5 »

adrian_broher wrote:
/home/FO/Downloads/freeorion_head/FreeOrion/network/Message.cpp:1022:15: required from here
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<boost::shared_ptr<System> >::************)’
/usr/local/include/boost/archive/basic_xml_iarchive.hpp:70:9: note: candidate is:
Boost serialization doesn't understand how to serialize a TemporaryPtr.

Code: Select all

    void serialize(Archive& ar, const unsigned int version)
    { ar & m_ptr; }
Should I be using BOOST_SERIALIZATION_NVP(m_ptr) instead?
Warning: Antarans in dimensional portal are closer than they appear.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: compilation failing with xml serialization

#4 Post by Geoff the Medio »

Bigjoe5 wrote:Should I be using BOOST_SERIALIZATION_NVP(m_ptr) instead?
It might help; I think the NVP marcos are specifically needed for XML serialization.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: compilation failing with xml serialization

#5 Post by adrian_broher »

Bigjoe5 wrote:

Code: Select all

    void serialize(Archive& ar, const unsigned int version)
    { ar & m_ptr; }
Should I be using BOOST_SERIALIZATION_NVP(m_ptr) instead?
If the code code you quoted there is the actual serialization function of the TemporaryPtr, then yes, BOOST_SERIALIZATION_NVP is needed there. As Geoff already mentioned this macro is responsible to create the tag inside the XML file.

so

Code: Select all

    void serialize(Archive& ar, const unsigned int version)
    { ar & BOOST_SERIALIZATION(m_ptr); }
would lead to

Code: Select all

<m_ptr>
<!-- serialiation representation of a boost::shared_ptr goes here -->
</m_ptr>
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: compilation failing with xml serialization

#6 Post by Dilvish »

yes, changing that line to

Code: Select all

    { ar & BOOST_SERIALIZATION_NVP(m_ptr); }
seems to have fixed the problem for me.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: compilation failing with xml serialization

#7 Post by Bigjoe5 »

Committed in rev 6334.
Warning: Antarans in dimensional portal are closer than they appear.

Post Reply