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

Linker/visibility warnings on macOS for boost log 1.68.0 #65

Closed
ghost opened this issue Nov 30, 2018 · 5 comments
Closed

Linker/visibility warnings on macOS for boost log 1.68.0 #65

ghost opened this issue Nov 30, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 30, 2018

I'm trying to compile boost 1.68.0 from source for a project on macOS and I'm getting a pile of linker warnings. The warnings go away when I compile my project with -fvisibility=hidden (as expected) however, my project is multi-module and the library dependent on boost must itself be visible to a few other libraries and executables.

What's going on here? Is there a way to address these errors?

Here's my configure and build commands:

./bootstrap.sh
      --prefix=some/prefix/in/my/build/folder
      --with-libraries=filesystem
      --with-libraries=locale
      --with-libraries=log
      --with-libraries=system
      --with-libraries=thread

./b2 install
      cxxstd=17 # because boost_system barfs when trying to link cxx17 code
      link=shared # I've also tried static
      variant=release
      threading=multi
      runtime-link=shared # I even tried static here just to see what would happen

And I'm linking these libraries:
boost_system, boost_thread, boost_filesystem, boost_locale, boost_log_setup, boost_log

@Lastique
Copy link
Member

Boost.Log is always built with hidden visibility. As far as I can tell, the warning says that Boost.Log code uses direct access to its symbols, so they won't be overridden at run time, which is the intention.

My advice would be to use hidden visibility everywhere, including your modules. Mark the symbols you need to export explicitly, with default visibility attributes or pragmas.

@ghost
Copy link
Author

ghost commented Nov 30, 2018

Is there any particular reason I don't need to do this with a package manager-installed binary of Boost.Log? I only started seeing this when I started compiling Boost.Log myself.

@Lastique
Copy link
Member

Sorry, I have no idea. I don't use Mac OS and I don't know how the packages are built there.

The first Boost.Log release which had hidden visibility enabled was 1.59, so if your system packages are older, they were likely compiled with default visibility.

@Lastique
Copy link
Member

Also, you might want to ensure that you're not linking with shared library when you build against the system libraries. In that case you probably won't get the warnings.

@ghost
Copy link
Author

ghost commented Nov 30, 2018

I was using 1.66.0 previously installed through homebrew, so I don't know why that's different given what you've said. I think I've got enough info to sort out how my project needs to build given the visibility requirements, though, and thanks 👍

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

1 participant