[1.35] Serialization shared_ptr_132 headers cause compilation error with g++ 4.1.0

Hi, I'm trying to update a code base to use boost 1.35 from boost 1.32. From what I've gathered, 1.35's code is frozen and considered to be fairly stable, so I figured that I wouldn't run into any errors caused by boost, just general changes that occurred between 1.32 and 1.35. Instead, it looks like I've definitely run into a bug being caused by 1.35, in particular, the serialization headers for shared_ptr. The following code: #include <boost/serialization/shared_ptr_132.hpp> #include <boost/serialization/shared_ptr.hpp> int main() { return 0; } Causes the following errors: g++ what.cc -o what -I /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35 /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp: In function ‘void boost::serialization::load(Archive&, boost::shared_ptr<U>&, unsigned int)’: /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: ‘null_deleter’ is not a member of ‘boost::archive::detail’ /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: ‘null_deleter’ is not a member of ‘boost::archive::detail’ /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: template argument 2 is invalid /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: expected `>' before ‘*’ token /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: expected `(' before ‘*’ token /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:124: error: expected primary-expression before ‘>’ token Looking at the documentation included with 1.35 says to retain backwards-compatibility for 1.32's shared_ptr by including both headers in the order I have included them, so I'm at a complete loss. I must retain compatibility with shared_ptr from 1.32 since there is a lot of serialized data floating around from 1.32, and its not feasible to find all of it and convert it mechanically. I hope someone can lend a helping hand. Thanks, Clif Houck

I'm not sure about the state of this. You might try the code at www.rrsd.com (1.36) and let me know how that works out. Robert Ramey Clif Houck wrote:
Hi,
I'm trying to update a code base to use boost 1.35 from boost 1.32. From what I've gathered, 1.35's code is frozen and considered to be fairly stable, so I figured that I wouldn't run into any errors caused by boost, just general changes that occurred between 1.32 and 1.35.
Instead, it looks like I've definitely run into a bug being caused by 1.35, in particular, the serialization headers for shared_ptr.
The following code:
#include <boost/serialization/shared_ptr_132.hpp> #include <boost/serialization/shared_ptr.hpp>
int main() { return 0; }
Causes the following errors:
g++ what.cc -o what -I /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35 /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp: In function 'void boost::serialization::load(Archive&, boost::shared_ptr<U>&, unsigned int)': /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: template argument 2 is invalid /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: expected `>' before '*' token /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:123: error: expected `(' before '*' token /usr/local/include/boost-1_35/boost/serialization/shared_ptr.hpp:124: error: expected primary-expression before '>' token
Looking at the documentation included with 1.35 says to retain backwards-compatibility for 1.32's shared_ptr by including both headers in the order I have included them, so I'm at a complete loss.
I must retain compatibility with shared_ptr from 1.32 since there is a lot of serialized data floating around from 1.32, and its not feasible to find all of it and convert it mechanically.
I hope someone can lend a helping hand.
Thanks, Clif Houck
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey <ramey <at> rrsd.com> writes:
I'm not sure about the state of this. You might try the code at www.rrsd.com (1.36) and let me know how that works out.
Robert Ramey
Simply substituting 1.36 headers from your website for the 1.35 ones, gives me the same errors: g++ what.cc -o what -I /home/chouck/Desktop/BoostZip/ -I /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35 /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp: In function ‘void boost::serialization::load(Archive&, boost::shared_ptr<U>&, unsigned int)’: /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: ‘null_deleter’ is not a member of ‘boost::archive::detail’ /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: ‘null_deleter’ is not a member of ‘boost::archive::detail’ /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: template argument 2 is invalid /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `>' before ‘*’ token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `(' before ‘*’ token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:124: error: expected primary-expression before ‘>’ token make: *** [all] Error 1 So it appears your current headers have the same problem. Clif

Hmmm - there is a test - http://www.rrsd.com/boost/library_status.html test_shared_ptr_132_text_archive which compiles and runs. How is this different than your situation? Doe sthe test need to be enhanced? Robert Ramey Clif Houck wrote:
Robert Ramey <ramey <at> rrsd.com> writes:
I'm not sure about the state of this. You might try the code at www.rrsd.com (1.36) and let me know how that works out.
Robert Ramey
Simply substituting 1.36 headers from your website for the 1.35 ones, gives me the same errors:
g++ what.cc -o what -I /home/chouck/Desktop/BoostZip/ -I /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35 /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp: In function 'void boost::serialization::load(Archive&, boost::shared_ptr<U>&, unsigned int)': /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: template argument 2 is invalid /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `>' before '*' token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `(' before '*' token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:124: error: expected primary-expression before '>' token make: *** [all] Error 1
So it appears your current headers have the same problem.
Clif
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey <ramey <at> rrsd.com> writes:
Hmmm - there is a test - http://www.rrsd.com/boost/library_status.html
test_shared_ptr_132_text_archive
which compiles and runs. How is this different than your situation? Doe sthe test need to be enhanced?
Robert Ramey
Clif Houck wrote:
Robert Ramey <ramey <at> rrsd.com> writes:
I'm not sure about the state of this. You might try the code at www.rrsd.com (1.36) and let me know how that works out.
Robert Ramey
Simply substituting 1.36 headers from your website for the 1.35 ones, gives me the same errors:
g++ what.cc -o what -I /home/chouck/Desktop/BoostZip/ -I /usr/local/include/boost-1_35/ -lboost_serialization-gcc41-mt-1_35 /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp: In function 'void boost::serialization::load(Archive&, boost::shared_ptr<U>&, unsigned int)': /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: 'null_deleter' is not a member of 'boost::archive::detail' /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: template argument 2 is invalid /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `>' before '*' token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:123: error: expected `(' before '*' token /home/chouck/Desktop/BoostZip/boost/serialization/shared_ptr.hpp:124: error: expected primary-expression before '>' token make: *** [all] Error 1
So it appears your current headers have the same problem.
Clif
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Well, I figured out what the problem was after diagnosing a little bit further. Apparently you must include at least one archive header before the shared_ptr header for correct compilation to occur. This example: //This header must come BEFORE the shared_ptr headers #include <boost/archive/binary_oarchive.hpp> #include <boost/serialization/shared_ptr_132.hpp> #include <boost/serialization/shared_ptr.hpp> int main() { return 0; } Was distilled from a larger, but still simple test program I wrote to make sure that I was writing code correctly to de-serialize 1.32 era shared_ptrs. In that program I made the mistake of including the archive headers AFTER the shared_ptr headers. I was under the impression that the serialization library had dispensed with header-order dependencies. I guess this isn't the case? Perhaps I didn't read the documentation closely enough. In any case, order dependencies for headers is very counter-intuitive and I'm sure a lot of other users have/will run into this problem. Is there some way to break the dependency? Clif Houck

Any existing header order dependency would be news to me and I would be interested in seeing it fixed. Given that you've expended the effort to find the problem in a specific case, do you have any suggestion about what change should be made? Robert Ramey Clif Houck wrote:
Well, I figured out what the problem was after diagnosing a little bit further. Apparently you must include at least one archive header before the shared_ptr header for correct compilation to occur.
This example:
//This header must come BEFORE the shared_ptr headers #include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/shared_ptr_132.hpp> #include <boost/serialization/shared_ptr.hpp>
int main() { return 0; }
Was distilled from a larger, but still simple test program I wrote to make sure that I was writing code correctly to de-serialize 1.32 era shared_ptrs. In that program I made the mistake of including the archive headers AFTER the shared_ptr headers.
I was under the impression that the serialization library had dispensed with header-order dependencies. I guess this isn't the case? Perhaps I didn't read the documentation closely enough. In any case, order dependencies for headers is very counter-intuitive and I'm sure a lot of other users have/will run into this problem. Is there some way to break the dependency?
Clif Houck
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey <ramey <at> rrsd.com> writes:
Any existing header order dependency would be news to me and I would be interested in seeing it fixed.
Given that you've expended the effort to find the problem in a specific case, do you have any suggestion about what change should be made?
Robert Ramey
I don't have a fix for it. The best suggestion I can offer is to analyze the headers for a header include cycle and then break it. As long as it compiles and de-serializes a 1.32 shared_ptr, it is sufficient for my purposes. I don't have time to analyze the headers myself at the moment, but I hope I've given you enough information to help you find the problem. Let me know if there's any more information I can give you. Clif Houck
participants (2)
-
Clif Houck
-
Robert Ramey