[ITK-dev] Workaround for dynamic_cast on Mac OSX

Isaiah Norton isaiah.norton at gmail.com
Mon Nov 14 15:08:47 EST 2016


On Mon, Nov 14, 2016 at 8:47 PM, Sean McBride <sean at rogue-research.com>
wrote:

> On Thu, 10 Nov 2016 14:11:59 -0500, Marcus D. Hanwell said:
>
> >I would be interested in further details on which case or cases are
> >causing dynamic_cast to fail, and why using consistent symbol
> >visibility in the interfaces is not feasible/possible.
>
> I'm not really following this issue, but...
>
> Is this really a Mac OS X issue, or is it being conflated with clang?
> That is, does the issue happen with clang on linux for example?  Is it only
> Apple's fork or clang, or the open source one too?  Does it happen with gcc
> on Mac OS X?  etc.
>

The compiler ABI rules and behavior have not changed. What has changed is
that OS X linker fallbacks have been removed [1], and Slicer (and perhaps
ITK itself by default, I haven't spelunked the log) have set the default
symbol visibility to hidden, which means that (now-hidden) type_info
symbols are not coalesced across compilation unit boundaries.

I would recommend this summary of the issue from a libreoffice commit
message [2], as well as the summary linked in a previous message [3].
Recent libstdc++ have reinstated a strcmp fallback [4], so the issue is
unlikely to be encountered on most Linux distributions.


[1] On OS X, my understanding is that libc++ (cxxabi) was compiled with
"_LIBCXX_DYNAMIC_FALLBACK" until OS X 10.11, which causes a fallback to
strcmp comparison of the type_info name (10.11 still contains a program
name-based fallback for two Adobe products that Apple could not reasonably
break).
[2]
https://lists.freedesktop.org/archives/libreoffice-commits/2015-January/091572.html
[3] http://www.russellmcc.com/posts/2013-08-03-rtti.html
[4] https://gcc.gnu.org/ml/gcc-patches/2009-07/msg01239.html


>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20161114/912ff934/attachment.html>


More information about the Insight-developers mailing list