Boost C++ Libraries: Ticket #13300: boost stacktrace broken on solaris https://svn.boost.org/trac10/ticket/13300 <p> Solaris <code>dladdr</code> doesn’t match function signature of most platforms nor the signature expected in boost stacktrace sources. </p> <p> Solaris: <code>int dladdr(void* addr, Dl_info* info);</code><br /> Darwin: <code>int dladdr(const void* addr, Dl_info* info);</code> </p> <p> This caused the following build errors on Solaris SPARC and Solaris X86. </p> <pre class="wiki">location_from_symbol.hpp, line 31: Error: Cannot cast away const or volatile. location_from_symbol.hpp, line 31: Error: Formal argument 1 of type void* in call to dladdr(void*, dl_info*) is being passed const void*. frame_unwind.ipp, line 87: Error: Cannot cast away const or volatile. frame_unwind.ipp, line 87: Error: Formal argument 1 of type void* in call to dladdr(void*, dl_info*) is being passed const void*const. </pre><p> Following diff seems to fix this issue: </p> <pre class="wiki">diff -ru a/boost/stacktrace/detail/frame_unwind.ipp b/boost/stacktrace/detail/frame_unwind.ipp --- a/boost/stacktrace/detail/frame_unwind.ipp Sat Aug 19 16:49:49 2017 +++ b/boost/stacktrace/detail/frame_unwind.ipp Fri Sep 15 20:12:08 2017 @@ -84,7 +84,7 @@ std::string frame::name() const { #if !defined(BOOST_WINDOWS) &amp;&amp; !defined(__CYGWIN__) ::Dl_info dli; +#if defined(__sun) + const bool dl_ok = !!::dladdr(const_cast&lt;void *&gt;(addr_), &amp;dli); +#else const bool dl_ok = !!::dladdr(addr_, &amp;dli); +#endif if (dl_ok &amp;&amp; dli.dli_sname) { return boost::core::demangle(dli.dli_sname); } diff -ru a/boost/stacktrace/detail/location_from_symbol.hpp b/boost/stacktrace/detail/location_from_symbol.hpp --- a/boost/stacktrace/detail/location_from_symbol.hpp Sat Aug 19 16:49:49 2017 +++ b/boost/stacktrace/detail/location_from_symbol.hpp Fri Sep 15 20:12:51 2017 @@ -28,7 +28,7 @@ explicit location_from_symbol(const void* addr) BOOST_NOEXCEPT : dli_() { +#if defined(__sun) + if (!::dladdr(const_cast&lt;void *&gt;(addr), &amp;dli_)) { +#else if (!::dladdr(addr, &amp;dli_)) { +#endif dli_.dli_fname = 0; } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13300 Trac 1.4.3 John Maddock Thu, 10 May 2018 11:06:16 GMT status, component changed; owner, resolution set https://svn.boost.org/trac10/ticket/13300#comment:1 https://svn.boost.org/trac10/ticket/13300#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">joseph.gauterin</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">obsolete</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">swap</span> </li> </ul> <p> Moved to <a class="ext-link" href="https://github.com/boostorg/stacktrace/issues/54"><span class="icon">​</span>https://github.com/boostorg/stacktrace/issues/54</a> </p> Ticket