[C++-sig] A very strange behaviour of Boost (Mingw, gcc 4.5)

Jérôme Laheurte fraca7 at free.fr
Fri Jun 10 14:16:19 CEST 2011

On 06/07/2011 09:59 AM, Lars Viklund wrote:

> On Tue, Jun 07, 2011 at 09:40:25AM +0200, Jérôme Laheurte wrote:
>> Hello. I already asked this on StackOverflow but it doesn't seem to
>> inspire many people. I managed to reduce my problem to a trivial
>> extension module:
>> On Windows XP SP3, if I build Boost 1.46.1 and then this extension with
>> GCC 3.4.5 from an older version of Mingw, everything behaves as expected:
>> Now if I rebuild both Boost and the module using a newer Mingw, with GCC
>> 4.5.2, this happens:
>> Any hint would be greatly appreciated.
> Typically, you need to use the same major flavor of toolchain to build
> Boost.Python and your extension as was used to build your Python.
> If the runtimes (and exception handling) differ, you'll get ODR
> violations on things like FILE* and error handling.
> What you're observing there is probably console output crashing when an
> error is printed. If the runtimes have different ideas of what
> constitutes a FILE* (which output is done through), you blow up good.
> This also includes using static runtimes to some extent.

Alas, this does not seem to be the case. I managed to rebuild Python 
with GCC 4.5 after some minor modifications of the interpreter code, 
then rebuilt boost and my extension. The same thing happens (except that 
the call stack is more detailed since the "upper" layers now have GCC 
debugging symbols).

Besides, if I replace throw_error_already_set() by PyErr_Print(), the 
message is properly displayed; and on the other hand in my actual use 
case, it works with some methods.

Still lost...

More information about the Cplusplus-sig mailing list