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

compilation error with cereal 1.3.1 #1886

Closed
lkeegan opened this issue Feb 21, 2022 · 2 comments
Closed

compilation error with cereal 1.3.1 #1886

lkeegan opened this issue Feb 21, 2022 · 2 comments

Comments

@lkeegan
Copy link
Member

lkeegan commented Feb 21, 2022

Compiling with -DWITH_SYSTEM_CEREAL=ON and an external installation of cereal v1.3.1 gives this compilation error:

In file included from /home/lkeegan/SSC/symengine/symengine/tests/basic/test_serialize-cereal.cpp:4:
/home/lkeegan/SSC/symengine/symengine/serialize-cereal.h:288:44: error: reference to type 'const std::shared_ptr<const void>' could not bind to an rvalue of type 'const SymEngine::Basic *'
    uint32_t id = ar.registerSharedPointer(ptr.get());
                                           ^~~~~~~~~
/home/lkeegan/SSC/symengine/symengine/serialize-cereal.h:311:5: note: in instantiation of function template specialization 'SymEngine::save_basic<cereal::BinaryOutputArchive>' requested here
    save_basic(ar, rcp_static_cast<const Basic>(ptr));
    ^
/home/lkeegan/install/include/cereal/cereal.hpp:532:9: note: in instantiation of function template specialization 'SymEngine::save<cereal::BinaryOutputArchive, SymEngine::Basic>' requested here
        CEREAL_SAVE_FUNCTION_NAME(*self, t);
        ^
/home/lkeegan/install/include/cereal/macros.hpp:92:35: note: expanded from macro 'CEREAL_SAVE_FUNCTION_NAME'
#define CEREAL_SAVE_FUNCTION_NAME save
                                  ^
/home/lkeegan/install/include/cereal/cereal.hpp:444:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::BinaryOutputArchive, 1>::processImpl<SymEngine::RCP<const SymEngine::Basic>, (cereal::traits::detail::sfinae)0>' requested here
        self->processImpl( head );
              ^
/home/lkeegan/install/include/cereal/cereal.hpp:333:15: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::BinaryOutputArchive, 1>::process<SymEngine::RCP<const SymEngine::Basic> &>' requested here
        self->process( std::forward<Types>( args )... );
              ^
/home/lkeegan/SSC/symengine/symengine/tests/basic/test_serialize-cereal.cpp:22:5: note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::BinaryOutputArchive, 1>::operator()<SymEngine::RCP<const SymEngine::Basic> &>' requested here
    cereal::BinaryOutputArchive{oss}(obj);
    ^
/home/lkeegan/SSC/symengine/symengine/tests/basic/test_serialize-cereal.cpp:37:44: note: in instantiation of function template specialization 'dumps<SymEngine::Basic>' requested here
    RCP<const Basic> basic2 = loads<Basic>(dumps<Basic>(basic1));
                                           ^
/home/lkeegan/install/include/cereal/cereal.hpp:398:85: note: passing argument to parameter 'sharedPointer' here
      inline std::uint32_t registerSharedPointer(const std::shared_ptr<const void>& sharedPointer)
                                                                                    ^
1 error generated.

Doing the same thing with cereal v1.3.0 (the same as the bundled version) compiles without errors.

@lkeegan
Copy link
Member Author

lkeegan commented Feb 21, 2022

But the bug is not in Symengine, this is a cereal bug: the v1.3.1 release didn't increment CEREAL_VERSION_PATCH

If I manually fix the patch version in my installation of cereal then symengine compiles & tests pass.

Relevant change in cereal is USCiLab/cereal@f27c12d, which is accounted for in Symengine here:

#if CEREAL_VERSION >= 10301
std::shared_ptr<void> sharedPtr = std::static_pointer_cast<void>(
std::make_shared<RCP<const Basic>>(ptr));
uint32_t id = ar.registerSharedPointer(sharedPtr);
#else
uint32_t id = ar.registerSharedPointer(ptr.get());
#endif
)

@lkeegan
Copy link
Member Author

lkeegan commented Feb 28, 2022

This can now be resolved by updating the external cereal version to v1.3.2

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

1 participant