order of headers with Boost.Serialization and Boost.MPI

Hello, I'm writing a code that uses Boost.MPI to send some GMP (http://gmplib.org/) datatypes around. Since I do not want to change GMP, I'm using the "non-intrusive" serialization support (code in attached file "gmpxx_boost_serialization.hpp"). However, I'm running into a strange include-order mess: * If I include first my "gmpxx_boost_serialization.hpp" and _then_ "boost/mpi.h", then I get a slew of errors (attached file "errors.txt") * If I reverse the include order, and include "boost/mpi.h" _first_, then everything compiles fine. Is this to be expected, or am I doing something wrong in my code? For the record, I'm compiling on Ubuntu 10.10, gcc 4.4.5, arch. amd64. Thanks for any hint! Best regards, Riccardo Murri -- Riccardo Murri, Hadlaubstr. 150, 8006 Zürich (CH)

On 22 Oct 2010, at 15:34, Riccardo Murri wrote:
Hello,
I'm writing a code that uses Boost.MPI to send some GMP (http://gmplib.org/) datatypes around. Since I do not want to change GMP, I'm using the "non-intrusive" serialization support (code in attached file "gmpxx_boost_serialization.hpp"). However, I'm running into a strange include-order mess:
* If I include first my "gmpxx_boost_serialization.hpp" and _then_ "boost/mpi.h", then I get a slew of errors (attached file "errors.txt")
* If I reverse the include order, and include "boost/mpi.h" _first_, then everything compiles fine.
Is this to be expected, or am I doing something wrong in my code?
For the record, I'm compiling on Ubuntu 10.10, gcc 4.4.5, arch. amd64.
Which Boost version is this? Matthias

On Sat, Oct 23, 2010 at 5:33 AM, Matthias Troyer
On 22 Oct 2010, at 15:34, Riccardo Murri wrote:
Hello,
I'm writing a code that uses Boost.MPI to send some GMP (http://gmplib.org/) datatypes around. Since I do not want to change GMP, I'm using the "non-intrusive" serialization support (code in attached file "gmpxx_boost_serialization.hpp"). However, I'm running into a strange include-order mess:
* If I include first my "gmpxx_boost_serialization.hpp" and _then_ "boost/mpi.h", then I get a slew of errors (attached file "errors.txt")
* If I reverse the include order, and include "boost/mpi.h" _first_, then everything compiles fine.
Is this to be expected, or am I doing something wrong in my code?
For the record, I'm compiling on Ubuntu 10.10, gcc 4.4.5, arch. amd64.
Which Boost version is this?
1.44.0 Best regards, Riccardo -- Riccardo Murri, Hadlaubstr. 150, 8006 Zürich (CH)

On Oct 23, 2010, at 12:34 AM, Riccardo Murri wrote:
Hello,
I'm writing a code that uses Boost.MPI to send some GMP (http://gmplib.org/) datatypes around. Since I do not want to change GMP, I'm using the "non-intrusive" serialization support (code in attached file "gmpxx_boost_serialization.hpp"). However, I'm running into a strange include-order mess:
* If I include first my "gmpxx_boost_serialization.hpp" and _then_ "boost/mpi.h", then I get a slew of errors (attached file "errors.txt")
* If I reverse the include order, and include "boost/mpi.h" _first_, then everything compiles fine.
Is this to be expected, or am I doing something wrong in my code?
For the record, I'm compiling on Ubuntu 10.10, gcc 4.4.5, arch. amd64.
Thanks for any hint!
Best regards, Riccardo Murri
Hi Riccardo, Unfortunately your example is not self-contained and I thus cannot reproduce the problem Matthias

Hi Matthias,
On Sun, Oct 24, 2010 at 3:38 PM, Matthias Troyer
Unfortunately your example is not self-contained and I thus cannot reproduce the problem
Here's all files needed to compile the example (gmp.h and gmpxx.h come from GMP 5.0.1); I get errors if I include GMP [include block (3) in foo.c] _before_ Boost.MPI [include block (2)]. A dump of the compiler errors is in files errorsXXX.txt (where XXX = order of the include blocks in foo.c) In the real code the situation is actually worse, because depending on the order of includes I either get errors like those in the attached dumps, or the compiler complains that there is no `serialize` method in class `mpq_class` (true, indeed I'm trying to use the non-intrusive approach). I've not been able -so far- to distil a minimal example that reproduces exactly the problem I'm having with the real code... I'm using Boost 1.44.0 on GCC 4.4.5 (Ubuntu 10.10). Thanks for any help!

Sorry, this time with attachments.
On Sun, Oct 24, 2010 at 9:52 PM, Riccardo Murri
Hi Matthias,
On Sun, Oct 24, 2010 at 3:38 PM, Matthias Troyer
wrote: Unfortunately your example is not self-contained and I thus cannot reproduce the problem
Here's all files needed to compile the example (gmp.h and gmpxx.h come from GMP 5.0.1); I get errors if I include GMP [include block (3) in foo.c] _before_ Boost.MPI [include block (2)]. A dump of the compiler errors is in files errorsXXX.txt (where XXX = order of the include blocks in foo.c)
In the real code the situation is actually worse, because depending on the order of includes I either get errors like those in the attached dumps, or the compiler complains that there is no `serialize` method in class `mpq_class` (true, indeed I'm trying to use the non-intrusive approach). I've not been able -so far- to distil a minimal example that reproduces exactly the problem I'm having with the real code...
I'm using Boost 1.44.0 on GCC 4.4.5 (Ubuntu 10.10).
Thanks for any help!

On Oct 24, 2010, at 9:55 PM, Riccardo Murri wrote:
Sorry, this time with attachments.
On Sun, Oct 24, 2010 at 9:52 PM, Riccardo Murri
wrote: Hi Matthias,
On Sun, Oct 24, 2010 at 3:38 PM, Matthias Troyer
wrote: Unfortunately your example is not self-contained and I thus cannot reproduce the problem
Here's all files needed to compile the example (gmp.h and gmpxx.h come from GMP 5.0.1); I get errors if I include GMP [include block (3) in foo.c] _before_ Boost.MPI [include block (2)]. A dump of the compiler errors is in files errorsXXX.txt (where XXX = order of the include blocks in foo.c)
In the real code the situation is actually worse, because depending on the order of includes I either get errors like those in the attached dumps, or the compiler complains that there is no `serialize` method in class `mpq_class` (true, indeed I'm trying to use the non-intrusive approach). I've not been able -so far- to distil a minimal example that reproduces exactly the problem I'm having with the real code...
I'm using Boost 1.44.0 on GCC 4.4.5 (Ubuntu 10.10).
Thanks for any help!
Hi Riccardo, This is not a Boost.MPI issue since the same problem occurs if I remove all of the Boost.MPI headers. Looking deeper into your code I find that the actual problem is that you call the macro BOOST_SERIALIZATION_SPLIT_FREE inside the namespace boost::serialization. It has to be called from outside of any namespace. Once I make that change your code compiles for me. Matthias

Hi Matthias,
many thanks for your help!
On Mon, Oct 25, 2010 at 11:10 AM, Matthias Troyer
Looking deeper into your code I find that the actual problem is that you call the macro BOOST_SERIALIZATION_SPLIT_FREE inside the namespace boost::serialization. It has to be called from outside of any namespace. Once I make that change your code compiles for me.
Indeed this solved the compilation problem, thanks. I didn't notice the warning in the docs, my bad. Best regards, Riccardo
participants (2)
-
Matthias Troyer
-
Riccardo Murri