diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-11-05 00:49:26 -0500 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2014-11-05 01:16:53 -0500 |
commit | 0246ab6088dc45507792fb152f72c42694c4f385 (patch) | |
tree | 6bbf0b490e95c4873beaace3c9ad937d1d59d39c | |
parent | 06037f3f46463e65ab74e0f34ba5f7a869d053fd (diff) |
depends: boost: hard-code hidden symbol visibility
tl;dr: This solves boost visibility problems for default/release build configs
on non-Linux platforms.
When Bitcoin builds against boost's header-only classes, it ends up with
objects containing symbols that the upstream boost libs also have. Since
Bitcoin builds by default with hidden symbol visibility, it can end up trying
to link against a copy of the same symbols with default visibility.
This is not a problem on Linux because 3rd party static libs are un-exported
by default (--exclude-libs,ALL), but that is not available for MinGW and OSX.
Those platforms (and maybe others?) end up confused about which version to use.
The OSX linker spews hundreds of: "ld: warning: direct access in <foo> to
global weak symbol guard variable for <bar> means the weak symbol cannot be
overridden at runtime. This was likely caused by different translation units
being compiled with different visibility settings."
MinGW's linker complains similarly.
Since the default symbol visibility for Bitcoin is hidden and releases are
built that way as well, build Boost with hidden visibility. Linux builds Boost
this way also, but only for the sake of continuity.
This means that the linker confusion logic is reversed, so the problem will
will now be encountered if Bitcoin is built with --disable-reduce-exports, but
that's better than the current situation.
-rw-r--r-- | depends/packages/boost.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 98ed3de772..53c4c3c74e 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -21,6 +21,7 @@ $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin $(package)_archiver_darwin=$($(package)_libtool) $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test +$(package)_cxxflags=-fvisibility=hidden $(package)_cxxflags_x86_64_linux=-fPIC $(package)_cxxflags_arm_linux=-fPIC endef |