depends: fix boost mac cross build with clang 9+ #17231

pull theuni wants to merge 1 commits into bitcoin:master from theuni:fix-boost-clang9 changing 1 files +2 −3
  1. theuni commented at 6:19 PM on October 23, 2019: member

    The ancient "darwin-4.9.1" profile has long been used to match against clang, which prior to version 9, reported 4.9.1 as its version when invoking "clang++ -dumpversion". Presumably this was a historical compatibility quirk related to Apple's switch from gcc to clang.

    This was "fixed" in clang 9.0, so that -dumpversion reports the real version. Unfortunately that had the side-effect of breaking the (brittle) boost compiler detection.

    Move to the seemingly more-correct "clang-darwin" profile, which passes the checks and builds correctly.

    Also switch to using ar rather than libtool for archiving, as it's what the clang-darwin profile expects to be using.

    Note that because this is using a different profile, some of the final command-line arguments end up changing. Those changes look sane at a glance.

  2. depends: fix boost mac cross build with clang 9+
    The ancient "darwin-4.9.1" profile has long been used to match against
    clang, which prior to version 9, reported 4.9.1 as its version when
    invoking "clang++ -dumpversion". Presumably this was a historical
    compatibility quirk related to Apple's switch from gcc to clang.
    
    This was "fixed" in clang 9.0, so that -dumpversion reports the real
    version. Unfortunately that had the side-effect of breaking the
    (brittle) boost compiler detection.
    
    Move to the seemingly more-correct "clang-darwin" profile, which passes
    the checks and builds correctly.
    
    Also switch to using ar rather than libtool for archiving, as it's what
    the clang-darwin profile expects to be using.
    
    Note that because this is using a different profile, some of the final
    command-line arguments end up changing. The changes look sane at a
    glance.
    50037e97d1
  3. fanquake added the label Build system on Oct 23, 2019
  4. fanquake added the label Needs gitian build on Oct 23, 2019
  5. fanquake commented at 1:39 PM on October 24, 2019: member

    ACK 50037e97d11356218c4b36767232e47b74742b0b - tested on on macOS, will wait for the gitian build.

    This came up as part of the discussion in #16392, which was going to bump our Clang version from 3.7.1 to 6.0.1. Cory suggested moving straight to latest (9.0.0), and we discovered that Boost wouldn't build.

    For a long time, Clangs -dumpversion has been hardcoded to return 4.2.1 (for compatibility with GCC), this was changed with Clang 9.0.0 (details here).

    This breaks our Boost compilation when using toolset=darwin-4.2.1. You can see how Boost is currently being configured on macOS in darwin.jam. The new profile is clang-darwin.jam.

    Also switch to using ar rather than libtool for archiving, as it's what the clang-darwin profile expects to be using.

    The clang-darwin config does expect ar. The darwin config used to use libtool.

    Note that because this is using a different profile, some of the final command-line arguments end up changing. Those changes look sane at a glance.

    From what I can see, the changed options between the two configurations are:

    We've lost -gdwarf-2 -fexceptions -Wno-long-long -fpermissive -pedantic:

    -gdwarf-2 Produce debugging information in DWARF version 2 format -fexceptions Enable exception handling. -fpermissive Downgrade some diagnostics about nonconformant code from errors to warnings. -Wpedantic Issue warnings needed for strict compliance to the standard.

    and picked up -x c++ -Wno-variadic-macros:

    -x <language> Treat subsequent input files as having type <language> -Wvariadic-macros Warn about using variadic macros.

    Note that -Wno-long-long is still being passed, it just used to be passed twice. Example full commands are below.

    toolset=darwin-4.2.1:

    darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/future.o
    
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-mmacosx-version-min=10.10" "-stdlib=libc++" "--sysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"   -fvisibility-inlines-hidden -std=c++11 -fvisibility=hidden     -I/Users/michael/github/bitcoin/depends/x86_64-apple-darwin18.7.0/include     -m64 -O3 -Wall -fvisibility=hidden -gdwarf-2 -fexceptions -Wno-long-long -Wno-inline -Wextra -Wno-long-long -Wno-unused-parameter -Wunused-function -fpermissive -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG  -I"." -c -o "bin.v2/libs/thread/build/darwin-4.2.1/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/future.o" "libs/thread/src/future.cpp"
    

    clang-darwin:

    clang-darwin.compile.c++ bin.v2/libs/thread/build/clang-darwin-11.0/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/future.o
    
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-mmacosx-version-min=10.10" "-stdlib=libc++" "--sysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" -x c++ -fvisibility-inlines-hidden -std=c++11 -fvisibility=hidden     -I/Users/michael/github/bitcoin/depends/x86_64-apple-darwin18.7.0/include     -m64 -O3 -Wall -fvisibility=hidden -Wno-inline -Wextra -Wno-long-long -Wno-unused-parameter -Wno-variadic-macros -Wunused-function -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2/libs/thread/build/clang-darwin-11.0/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/future.o" "libs/thread/src/future.cpp"
    
  6. theuni commented at 2:01 PM on October 24, 2019: member

    This came up as part of the discussion in #16392, which was going to bump our Clang version from 3.7.1 to 6.0.1. Cory suggested moving straight to latest (9.0.0), and we discovered that Boost wouldn't build.

    Just a slight clarification: I suggested that if we're bumping clang, maybe we should bump higher than 6.0. I jumped straight to 9.0 first, just to make sure we still work with the most recent release.

    This change will be necessary eventually, and should work fine with older clang builds as well.

    Now that we can (presumably) pick anything between 3.7 and 9.0, we can evaluate and choose whatever makes the most sense.

  7. laanwj commented at 4:14 PM on October 24, 2019: member

    -gdwarf-2 Produce debugging information in DWARF version 2 format

    I think that's good. DWARF 2 is really ancient (90's), and not useful at all for modern C++ compiler output.

  8. MarcoFalke commented at 8:29 PM on October 24, 2019: member

    Concept ACK, haven't looked at the diff

  9. DrahtBot commented at 3:04 AM on October 25, 2019: member

    <!--a722867cd34abeea1fadc8d60700f111-->

    Gitian builds for commit b688b859dbb2b5af2e9d19cae9dce3e3e14bd2c1 (master):

    Gitian builds for commit c266777991074921e6f75ed2e22db46d42a114af (master and this pull):

  10. DrahtBot removed the label Needs gitian build on Oct 25, 2019
  11. laanwj referenced this in commit 366753e46e on Oct 25, 2019
  12. laanwj merged this on Oct 25, 2019
  13. laanwj closed this on Oct 25, 2019

  14. deadalnix referenced this in commit 74131da584 on Apr 6, 2020
  15. MarkLTZ referenced this in commit 8823f65197 on Apr 7, 2020
  16. MarkLTZ referenced this in commit 0a1571d657 on Apr 7, 2020
  17. ftrader referenced this in commit 8ea7cd296c on Aug 17, 2020
  18. zkbot referenced this in commit a0158ce837 on Jan 15, 2021
  19. xdustinface referenced this in commit badc91f98e on Feb 17, 2021
  20. furszy referenced this in commit 8d2207cb8b on May 9, 2021
  21. DrahtBot locked this on Dec 16, 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:14 UTC

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