[Serialization] test_exported_*_archive failures

On trunk, revision 43795. Does anyone know why these are failing? These are the only tests failing on my machine (g++ 4.1.3 on 32-bit Linux). Additionally test_*_dll don't seem to be running either... Anyway, the error I see is: ../libs/serialization/test/test_tools.hpp(182): unregistered void cast in function 'int main(int, char**)'
From a quick inspection, it appears that the cast between base and derived never gets registered.
I'm actually unsure as to how the void cast can get registered *before* BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base) gets executed and therefore, I'm not sure how these tests are passing anywhere else. Where/when is the Base<->Derived cast supposed to be registered in test_exported.cpp? I can only see it being registered when serialize is called for the first time on the polymorphic_derived[12]. -- Sohail Somani http://uint32t.blogspot.com

On Sun, 23 Mar 2008 06:11:23 +0000, Sohail Somani wrote:
Does anyone know why these are failing? These are the only tests failing on my machine (g++ 4.1.3 on 32-bit Linux). Additionally test_*_dll don't seem to be running either... Anyway, the error I see is:
../libs/serialization/test/test_tools.hpp(182): unregistered void cast in function 'int main(int, char**)'
Hmm... I was under the impression that there is no longer a header ordering requirement for export.hpp. Strangely enough, the following diff fixes the problem for me. Index: test_exported.cpp =================================================================== --- test_exported.cpp (revision 43795) +++ test_exported.cpp (working copy) @@ -19,11 +19,11 @@ #endif #include <boost/serialization/base_object.hpp> -#include <boost/serialization/export.hpp> #include <boost/serialization/type_info_implementation.hpp> #include <boost/archive/archive_exception.hpp> #include "test_tools.hpp" +#include <boost/serialization/export.hpp> // <--- oops??? #include "base.hpp" -- Sohail Somani http://uint32t.blogspot.com

Sohail Somani wrote:
On Sun, 23 Mar 2008 06:11:23 +0000, Sohail Somani wrote:
Does anyone know why these are failing? These are the only tests failing on my machine (g++ 4.1.3 on 32-bit Linux). Additionally test_*_dll don't seem to be running either... Anyway, the error I see is:
../libs/serialization/test/test_tools.hpp(182): unregistered void cast in function 'int main(int, char**)'
Hmm... I was under the impression that there is no longer a header ordering requirement for export.hpp. Strangely enough, the following diff fixes the problem for me.
Hmmm - I was also under the impression that there was no longer such a header ordering requirement. This will have to be looked into. Your fix will give a good clue. Thanks a lot. Robert Ramey
Index: test_exported.cpp =================================================================== --- test_exported.cpp (revision 43795) +++ test_exported.cpp (working copy) @@ -19,11 +19,11 @@ #endif
#include <boost/serialization/base_object.hpp> -#include <boost/serialization/export.hpp> #include <boost/serialization/type_info_implementation.hpp>
#include <boost/archive/archive_exception.hpp> #include "test_tools.hpp" +#include <boost/serialization/export.hpp> // <--- oops???
#include "base.hpp"

This is a very good observation. I'll make the change and see if it "fixes" similar problems on other platforms. Having said this, it shouldn't make any difference. there should be no header order requirement. Dave Abrahams - could you take a look at this? Robert Ramey Sohail Somani wrote:
On Sun, 23 Mar 2008 06:11:23 +0000, Sohail Somani wrote:
Does anyone know why these are failing? These are the only tests failing on my machine (g++ 4.1.3 on 32-bit Linux). Additionally test_*_dll don't seem to be running either... Anyway, the error I see is:
../libs/serialization/test/test_tools.hpp(182): unregistered void cast in function 'int main(int, char**)'
Hmm... I was under the impression that there is no longer a header ordering requirement for export.hpp. Strangely enough, the following diff fixes the problem for me.
Index: test_exported.cpp =================================================================== --- test_exported.cpp (revision 43795) +++ test_exported.cpp (working copy) @@ -19,11 +19,11 @@ #endif
#include <boost/serialization/base_object.hpp> -#include <boost/serialization/export.hpp> #include <boost/serialization/type_info_implementation.hpp>
#include <boost/archive/archive_exception.hpp> #include "test_tools.hpp" +#include <boost/serialization/export.hpp> // <--- oops???
#include "base.hpp"

On Sun, 23 Mar 2008 11:33:53 -0800, Robert Ramey wrote:
This is a very good observation. I'll make the change and see if it "fixes" similar problems on other platforms.
Having said this, it shouldn't make any difference. there should be no header order requirement. Dave Abrahams - could you take a look at this?
Even if it does "fix" the problem on other platforms, I bet the header ordering is just a symptom and not the cause. -- Sohail Somani http://uint32t.blogspot.com

On Sun, 23 Mar 2008 11:33:53 -0800, Robert Ramey wrote:
This is a very good observation. I'll make the change and see if it "fixes" similar problems on other platforms.
Having said this, it shouldn't make any difference. there should be no header order requirement. Dave Abrahams - could you take a look at this?
FYI, it seems to be broken since revision 34106. 34105 built fine. Yay for SVN. -- Sohail Somani http://uint32t.blogspot.com

On Sun, 23 Mar 2008 23:12:34 +0000, Sohail Somani wrote:
On Sun, 23 Mar 2008 11:33:53 -0800, Robert Ramey wrote: , it shouldn't make any difference. there should be no
header order requirement. Dave Abrahams - could you take a look at this?
FYI, it seems to be broken since revision 34106. 34105 built fine. Yay for SVN.
Filed a bug: http://svn.boost.org/trac/boost/ticket/1711 -- Sohail Somani http://uint32t.blogspot.com

Sohail Somani wrote:
On trunk, revision 43795.
Does anyone know why these are failing? These are the only tests failing on my machine (g++ 4.1.3 on 32-bit Linux).
This has been a mystery to me. I have not yet been able to figure this out. Any help appreciated.
Additionally test_*_dll don't seem to be running either...
These have been removed from the test suite in order to cut down on test time. On my own machine, I use Library_test in order to produce a table of test results for all build configurations debug/release, shared, etc. So I no longer need to make separate *_dll tests.
Anyway, the error I see is:
../libs/serialization/test/test_tools.hpp(182): unregistered void cast in function 'int main(int, char**)'
From a quick inspection, it appears that the cast between base and derived never gets registered.
I'm actually unsure as to how the void cast can get registered *before* BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base) gets executed and therefore, I'm not sure how these tests are passing anywhere else.
LOL - this is a key trick used by the library - very convenient and a common source of consternation. refers to a static object. With some care, such objects can be created at "pre-main" time so that they are available BEFORE they are referred to in the code. That is the mechanism which makes the tests pass everywhere else. This mechanism is compiler dependent though so sometimes (like here) we have some problems. Note that this is a key implementation technique which makes the serialization 'automatically" instantiate required code- and only the required code.
Where/when is the Base<->Derived cast supposed to be registered in test_exported.cpp? I can only see it being registered when serialize is called for the first time on the polymorphic_derived[12].
Its registered at "pre-main" time as described above. Robert Ramey

On Sun, 23 Mar 2008 09:37:42 -0800, Robert Ramey wrote:
From a quick inspection, it appears that the cast between base and derived never gets registered.
I'm actually unsure as to how the void cast can get registered *before* BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base) gets executed and therefore, I'm not sure how these tests are passing anywhere else.
LOL - this is a key trick used by the library - very convenient and a common source of consternation. refers to a static object. With some care, such objects can be created at "pre-main" time so that they are available BEFORE they are referred to in the code. That is the mechanism which makes the tests pass everywhere else. This mechanism is compiler dependent though so sometimes (like here) we have some problems.
Note that this is a key implementation technique which makes the serialization 'automatically" instantiate required code- and only the required code.
This was my understanding of the library but I could not determine what code is *not* being instantiated/referenced. Could you point me towards what code is expected to be instantiated? Then I can do some debugging. No LOLing! This is serious business :-) -- Sohail Somani http://uint32t.blogspot.com

base_object refers to void_cast which refers to a static object constructed at pre-main time. Look at the definition of base_object. Robert Ramey Sohail Somani wrote: Could you point me
towards what code is expected to be instantiated? Then I can do some debugging.
No LOLing! This is serious business :-)

On Sun, 23 Mar 2008 11:15:55 -0800, Robert Ramey wrote:
base_object refers to void_cast which refers to a static object constructed at pre-main time. Look at the definition of base_object.
I assume you mean: template <class Derived, class Base> BOOST_DLLEXPORT void_caster_primitive<Derived,Base> const& void_caster_primitive<Derived,Base>::instance = void_caster_primitive<Derived,Base>::get_instance(); This is not guaranteed to be executed before main since void_caster_primitive<Derived,Base> requires dynamic initialization. My guess is that this is the problem. -- Sohail Somani http://uint32t.blogspot.com

Hmm - I expicitly test to guarentee that that get_instance is never called after main is invoked so I would have to look into thi sin more detail. Robert Ramey Sohail Somani wrote:
On Sun, 23 Mar 2008 11:15:55 -0800, Robert Ramey wrote:
base_object refers to void_cast which refers to a static object constructed at pre-main time. Look at the definition of base_object.
I assume you mean:
template <class Derived, class Base> BOOST_DLLEXPORT void_caster_primitive<Derived,Base> const& void_caster_primitive<Derived,Base>::instance = void_caster_primitive<Derived,Base>::get_instance();
This is not guaranteed to be executed before main since void_caster_primitive<Derived,Base> requires dynamic initialization. My guess is that this is the problem.

On Sun, 23 Mar 2008 13:06:34 -0800, Robert Ramey wrote:
Hmm - I expicitly test to guarentee that that get_instance is never called after main is invoked so I would have to look into thi sin more detail.
Robert Ramey
Let me know if there are any changes you want me to try. -- Sohail Somani http://uint32t.blogspot.com
participants (2)
-
Robert Ramey
-
Sohail Somani