I'm trying to get my MAC OS (Yosemite) to build the boost serialization library and I've having a problem. In a couple of tests, the program throws some exceptions. When this occurs I get a message something like "terminate called after throwing an instance of 'boost::archive::archive_exception'". I'm quite sure that I used to be able to do this without problem - as of a couple of months ago. I recently "upgraded" to Yosemite. My gcc-4.8.1 version I'm getting from HPC website. In the course of trying to figure this out, I've come upon boost documentation which explains BOOST_SYMBOL_VISIBLE which was new to me. It suggests that my code which looks like class archive_exception : public virtual std::exception { ... could be creating a problem. due to deriving from some other class which might be defined a runtime shared library. So I replaced it with: class BOOST_SYMBOL_VISIBLE archive_exception : public virtual std::exception { ... and I also tried class BOOST_SYMBOL_VISIBLE archive_exception : public virtual std::exception { ... This doesn't change anything so it looks like I'm barking up the wrong tree. Is there anyone here who might want to shed some light on this? Robert Ramey -- View this message in context: http://boost.2283326.n4.nabble.com/BOOST-SYMBOL-VISIBLE-tp4673673.html Sent from the Boost - Dev mailing list archive at Nabble.com.
I fixed my problem by using the gcc 4.9 instead. I'm still sort of curious about problems making symbols visible across shared libraries. I'm wondering if this might explain some here-to-for impossible to find causes for obscure test failures. Robert Ramey -- View this message in context: http://boost.2283326.n4.nabble.com/BOOST-SYMBOL-VISIBLE-tp4673673p4673677.ht... Sent from the Boost - Dev mailing list archive at Nabble.com.
On Sun, Mar 22, 2015 at 11:08 PM, Robert Ramey
I fixed my problem by using the gcc 4.9 instead.
I'm still sort of curious about problems making symbols visible across shared libraries. I'm wondering if this might explain some here-to-for impossible to find causes for obscure test failures.
It looks like it is the same issue than https://svn.boost.org/trac/boost/ticket/11070 Which point to this explaination: http://stackoverflow.com/questions/19496643/using-clang-fvisibility-hidden-a... where switching to gcc indeed make this kind of issues disapear.
Robert Ramey
-- View this message in context: http://boost.2283326.n4.nabble.com/BOOST-SYMBOL-VISIBLE-tp4673673p4673677.ht... Sent from the Boost - Dev mailing list archive at Nabble.com.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
On 22 Mar 2015 at 13:31, Robert Ramey wrote:
I'm trying to get my MAC OS (Yosemite) to build the boost serialization library and I've having a problem. In a couple of tests, the program throws some exceptions. When this occurs I get a message something like "terminate called after throwing an instance of 'boost::archive::archive_exception'". [snip] This doesn't change anything so it looks like I'm barking up the wrong tree. Is there anyone here who might want to shed some light on this?
I as the person who originally added symbol hiding to GCC am as much to blame as anybody. Back in the day when I originally patched GCC with this stuff, I very liberally sploshed default visibility over everything (vtables, typeinfo etc). That caused problems with template specialised visibility whereby one can metaprogram visibility, so they ended up paring down my code instead of banning the practice, as I would have preferred (I only cared about Windows __declspec equivalance, and I still only do, and I suspect so does 99.99% of everybody else). That resulted in a problem where if base class visibility did not match derived class visibility then you got two copies of the base class typeinfo generated, and the catch(...) implementation historically used to only compare typeinfo pointers, not their contents. That got fixed by changing GCC to always compare typeinfo strings, so throwing and catching exceptions became much slower. LLVM chose to keep exception types not being matched. What really *should* have happened is that std::exception and all the STL exceptions must always have default visibility, and indeed it normally does in most implementations. I personally would have preferred if the compiler permanently marked default visibility on any type, or relation thereof, ever thrown or caught. But the ship sailed on that too. Anyway, what you're facing here are some compiler implementation inconsistencies, probably caused by the virtual inheritance which was always not a regularly tested code path for symbol visibility and exception unwinding. A huge problem with ELF visibility is that it is sticky to hidden, so you need just one hidden declaration anywhere in any of the shared objects loaded by the process (including dynamically loaded ones) and it'll hide the symbol for everybody irrespective of declarations anywhere else (I tried getting GNU ld to issue a warning when visibilities mismatch, and it got closed as wontfix). I personally would recommend you drop the virtual inheritance and your problems will go away, but if as I assume you can't, if on C++ 11 try catching all and using intrusive inspection of exception_ptr for your STL to do the type matching by hand, in particular do strcmp of the typeinfo strings. ELF is a steaming dog turd of a binary format, and its many design flaws cost millions of wasted programmer hours. I would just *love* if it got killed off as soon as humanly possible, but there is zero consensus nor funding available for a replacement. That said, your problems appear to be on Mac which is Mach O binaries, and I never found those to be anything like as problematic, old as they are. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (3)
-
Klaim - Joël Lamotte
-
Niall Douglas
-
Robert Ramey