depends: boost: hard-code hidden symbol visibility #5213

pull theuni wants to merge 1 commits into bitcoin:master from theuni:deps-visibility changing 1 files +1 −0
  1. theuni commented at 7:16 AM on November 5, 2014: member

    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.

  2. 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.
    0246ab6088
  3. laanwj commented at 7:58 AM on November 5, 2014: member

    ACK

  4. randy-waterhouse commented at 6:15 AM on November 6, 2014: contributor

    ACK

  5. laanwj merged this on Nov 6, 2014
  6. laanwj closed this on Nov 6, 2014

  7. laanwj referenced this in commit 168de66a7e on Nov 6, 2014
  8. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me