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

Niall Douglas s_sourceforge at nedprod.com
Fri Jun 10 17:00:53 CEST 2011


On 10 Jun 2011 at 16:03, Jérôme Laheurte wrote:

> > Might this be a symbol visibility problem?
> 
> How can I check that ? I just tried #defining 
> BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY in boost/python/detail/config.hpp 
> and rebuilt the whole stuff but there's no difference.

I have little experience of Mingw personally. If I want to build for 
Windows, I use MSVC :)

On POSIX, older versions of the GCC runtime require you to always 
keep symbols which are used to throw exceptions as default visibility 
as they compare symbols by address not content. Newer GCC runtimes 
finally do what I said they should have done from the beginning which 
is to string compare the mangled symbol.

If BPL is throwing an exception and the catch handler isn't being 
found like it ought to be, this suggests they've broken the above in 
the Mingw port of GCC somehow. It could also be a problem of stack 
corruption causing the unwind records to get corrupted. I can't be 
any more definite because how PE binaries use symbols differently to 
ELF kinda suggests that GCC surely isn't copying the POSIX GCC 
exception type matching system anyway.

If you're really keen on continuing to use Mingw, I'd first suggest 
you see if you can duplicate the problem in Cygwin. If you can you'll 
get a much bigger audience. Then you'll need a very reduced example 
exhibiting the bug, one not including Boost. Then you'll need to come 
up with a patch to PE GCC to fix it and wait the whatever number of 
weeks to get it into mainline.

Or you could stick with an older version of Mingw and wait till 
someone else fixes the problem. Or use MSVC.

BTW, debugging exception throws is a royal PITA. There ought to be 
some debug code in the GCC runtime if I remember, you could try 
turning that on and it will print each stage of what it does when you 
throw and/or rethrow an exception.

HTH,
Niall

-- 
Technology & Consulting Services - ned Productions Limited.
http://www.nedproductions.biz/. VAT reg: IE 9708311Q. Company no: 
472909.





More information about the Cplusplus-sig mailing list