macOS: Evaluate removing `xcrun`s in darwin builder #18959

issue dongcarl opened this issue on May 12, 2020
  1. dongcarl commented at 2:39 PM on May 12, 2020: member

    When building on macOS, as in, using the depends/builders/darwin.mk, we currently use xcrun to determine the right paths for well-known tools. https://github.com/bitcoin/bitcoin/blob/8da1e43b63cb36759eeb1fcfd6768163265c44e2/depends/builders/darwin.mk#L1-L22

    However, it seems like:

    1. We can just invoke the tools directly (e.g. clang vs $(xcrun -f clang))
    2. Invoking tools directly will give have behavior that we expect without extra flags: #18743 (comment)

    My hypothesis is that the right way to invoke clang on macOS for non-Xcode projects like ours is to invoke it directly (which is what a naive build script would expect), and that $(xcrun -f clang) is being specialized for Xcode, which is why it doesn't work too well without extra flags as seen here: #18743

  2. dongcarl added the label good first issue on May 12, 2020
  3. dongcarl added the label Build system on May 12, 2020
  4. ryanofsky commented at 9:37 PM on May 14, 2020: member

    Practically, how should someone interested in this as a good first issue test the "hypothesis is that the right way to invoke clang" is to invoke it directly? Just drop xcrun calls and verify the depends and bitcoin builds don't fail?

    Other thoughts:

    • This doesn't seem to be distinguishing between the build_darwin_CC etc variables used to build build dependencies and the darwin_CC etc variables used to build runtime dependencies. Previously I figured you could get away with not using the SDK for the build dependencies, but would have to use it for the runtime dependencies, especially qt.

    • For more background, Cory (@theuni) first suggested dropping xcrun in #16367 (comment), and I think it got a little bit of testing with https://github.com/ryanofsky/bitcoin/commit/04bec8d2844e0cd2e09a62b21b006292f33f8093 from that PR and the saga described #18677 (review) ending in #18743

    • While it seems silly to keep xcrun calls if they aren't needed, it's also not obvious what advantages would be gained from dropping them if they are working now. (Could be worth expanding issue description if there are advantages this is looking for.)

    • There are other possibilities besides:

      build_darwin_CC:=clang
      build_darwin_CXX:=clang++
      

      and

      build_darwin_CC:=$(shell xcrun -f clang)
      build_darwin_CXX:=$(shell xcrun -f clang++)
      

      Another option would be to use the default system compiler, whether or not is clang:

      build_darwin_CC:=cc
      build_darwin_CXX:=c++
      

      Or just delete these lines, in which case I think they will default automatically to cc c++ ar nm etc.

  5. ivanacostarubio commented at 5:57 PM on February 27, 2021: none

    I built the project on macOS Big Sur 11.2.2 after the change above ... it seems ok!

  6. fanquake commented at 12:37 PM on March 4, 2021: member

    Closing this for now, per discussion in #21341.

  7. fanquake closed this on Mar 4, 2021

  8. fanquake removed the label good first issue on Apr 6, 2021
  9. DrahtBot locked this on Aug 18, 2022

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-05-01 03:15 UTC

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