[system] symbol visibility and GCC vs. Clang

When trying to link a bunch of libraries on OS X, I got this linker warning: ld: warning: direct access in boost::system::system_error::~system_error() to global weak symbol vtable for boost::system::system_error means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. As far as I can tell, everything is compiled using the flags -fvisibility=hidden -fvisibility-inlines-hidden. I'm wondering whether the problem is that some of the libraries were built using gcc and some were built using Clang. In boost/system/system_error.hpp, the declaration of boost::system::system_error is decorated with BOOST_SYMBOL_VISIBLE. In boost/config/compiler/gcc.hpp, BOOST_SYMBOL_VISIBLE is defined to be __attribute__((visibility("default"))), whereas boost/config/compiler/clang.hpp does not define BOOST_SYMBOL_VISIBLE. -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/

On 22/10/12 23:29, James Walker wrote:
When trying to link a bunch of libraries on OS X, I got this linker warning:
ld: warning: direct access in boost::system::system_error::~system_error() to global weak symbol vtable for boost::system::system_error means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
As far as I can tell, everything is compiled using the flags -fvisibility=hidden -fvisibility-inlines-hidden.
I'm wondering whether the problem is that some of the libraries were built using gcc and some were built using Clang. In boost/system/system_error.hpp, the declaration of boost::system::system_error is decorated with BOOST_SYMBOL_VISIBLE. In boost/config/compiler/gcc.hpp, BOOST_SYMBOL_VISIBLE is defined to be __attribute__((visibility("default"))), whereas boost/config/compiler/clang.hpp does not define BOOST_SYMBOL_VISIBLE.
This looks like a significant bug, POSIX-style symbol visibility doesn't work with Clang. Please file a ticket. Forwarding to developers mailing list.

On 10/23/2012 4:39 AM, Mathias Gaunard wrote:
On 22/10/12 23:29, James Walker wrote:
When trying to link a bunch of libraries on OS X, I got this linker warning:
ld: warning: direct access in boost::system::system_error::~system_error() to global weak symbol vtable for boost::system::system_error means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
As far as I can tell, everything is compiled using the flags -fvisibility=hidden -fvisibility-inlines-hidden.
I'm wondering whether the problem is that some of the libraries were built using gcc and some were built using Clang. In boost/system/system_error.hpp, the declaration of boost::system::system_error is decorated with BOOST_SYMBOL_VISIBLE. In boost/config/compiler/gcc.hpp, BOOST_SYMBOL_VISIBLE is defined to be __attribute__((visibility("default"))), whereas boost/config/compiler/clang.hpp does not define BOOST_SYMBOL_VISIBLE.
This looks like a significant bug, POSIX-style symbol visibility doesn't work with Clang. Please file a ticket.
OK, thanks. https://svn.boost.org/trac/boost/ticket/7559 -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.com/
participants (2)
-
James Walker
-
Mathias Gaunard