Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should boost force symbol visibility if built as a static lib? #145

Closed
epvbergen opened this issue Sep 20, 2018 · 3 comments
Closed

Should boost force symbol visibility if built as a static lib? #145

epvbergen opened this issue Sep 20, 2018 · 3 comments

Comments

@epvbergen
Copy link

epvbergen commented Sep 20, 2018

I'm consuming boost::asio as a static library in a project that is delivered as a shared library. To avoid conflicts in clients, I try to hide all symbols originating from my dependencies by linking with -Wl,--exclude-libs,ALL.

To my surprise, this does not work for boost::asio. A little research showed that at some point it was deemed a good idea to force default visibility on exception typeinfo and support classes for printing the exceptions from boost, see eg. https://svn.boost.org/trac10/ticket/4594 which proposed a #pragma visibility push default, only conditional on the compiler. So regardless of whether boost is built as a static or a dynamic library, the symbols get marked with default visibility on GCC.

And now I wonder if this is really the correct policy, or if boost (and any library) should rather refrain from explicitly setting visibility attributes when building a static library. Doesn't that make more sense?

Right now I have a nasty symbol leak that causes conflicts in my clients using a different version of asio. Updated: the problem has been reported before, along with a possible solution, see https://svn.boost.org/trac10/ticket/12722.

@apolukhin
Copy link
Member

Good point. Could you please move that issue to the https://github.com/boostorg/config repo. Fixing it there will fix all the boost libraries in one go.

@epvbergen
Copy link
Author

Thanks, it's now at boostorg/config#243

@mzeren-vmw
Copy link

I'm a bit confused. How does moving this bug to config fix:
https://github.com/boostorg/asio/blob/develop/include/boost/asio/detail/push_options.hpp#L26
See also: https://svn.boost.org/trac10/ticket/12722
Which we workaround by patching our Asio build to remove the visibility pragmas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants