Skip to content

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Jul 15, 2019

TLDR: This updates our macOS toolchain to use a newer version of Clang, cctools (including new dependency on libtapi), LD64 and the macOS SDK.

I've been testing depends builds (HOST=x86_64-apple-darwin16) inside a Debian Buster Docker container, and running the resultant bitcoind and bitcoin-qt binaries on a macOS 10.14.4 system. The .dmg generated by a make deploy also mounts correctly on the same macOS system.

Clang

Upgraded from 3.7.1 to 6.0.1

cctools

See tpoechtrager/cctools-port and tpoechtrager/apple-libtapi.

macOS SDK

Upgraded from building against the macOS 10.11 SDK to the macOS 10.14 SDK.

TODO

  • Make the 10.14 SDK available to Travis.

Fixes: #16052
Closes: #14797

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 15, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17919 (depends: Allow building with system clang by dongcarl)
  • #15441 ([doc] build: warn against spaces in working directory by Sjors)
  • #12557 ([WIP] 64 bit iOS device support by Sjors)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@fanquake fanquake force-pushed the macos-toolchain-update branch from 077b9df to 31f7825 Compare July 15, 2019 09:02
Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Concept ack.

+1 for a new prog to replace our dmg hacks. I think that might also mean that we could get rid of CMake.

Will review in depth.

@bitcoin bitcoin deleted a comment from DrahtBot Jul 22, 2019
@practicalswift
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

Needs rebase

@Sjors
Copy link
Member

Sjors commented Jul 25, 2019

Tested building depends on macOS 10.14.6 Mojave. I still had to do this annoying workaround:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

And building protobuf fails: log

If I remove protobuf and native_protobuf it does build. I can then compile QT:

./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-apple-darwin18.7.0 --disable-bip70
make

This works, but I get a flood of warnings at the end: log

Will test on macOS 10.15 Catalina later.

We should backport this to 0.18 given #16387 and ideally do a 0.18.2 tag before Catalina is out (September or October). Our 0.19 release is scheduled for November #15940, so otherwise there's no tag to build from.

Concept ACK on bumping macOS from 10.10 to 10.12, though a small percentage of users would have to stay on the 0.18 branch (the last tag before backport).

The bottleneck for upgrading macOS is hardware, and that's pretty durable. Here are the minimum specs for 10.10:
system 10 10

Minimum specs for 10.12:
system 10 12

Some refurbished machines for sale:
refurbished

Some second hand machines at an even lower price point still work:
macbook pro 2011

Some don't:
macbook pro 2009

@fanquake
Copy link
Member Author

I still had to do this annoying workaround:

Yep, that isn't new with this change, but may go away if we can remove any reliance on having the headers in the now deprecated location. See details in the Command Line Tools section of the Xcode 10 release notes.

If I remove protobuf and native_protobuf it does build. I can then compile QT:

Did you try to build depends before installing the new headers? If you make clean in depends, then try rebuilding as usual it should work. Nothing Protobuf related is being changed in this PR.

@fanquake fanquake force-pushed the macos-toolchain-update branch from 31f7825 to 536034b Compare July 26, 2019 01:01
@jonasschnelli
Copy link
Contributor

Concept ACK.
Unsure about the timing, if its already the time to drop 10.10 & 10.11 since 10.11 was released on Oct 2015.
According to statista, in April 2019, 10.10 and 10.11 makes about 16% of mac installations.
(https://www.statista.com/statistics/944559/worldwide-macos-version-market-share/)

Aidium publishes their update stats and it looks like, >10% was using 10.11 this week.
https://www.adium.im/sparkle/

It'd say we wait with this.

@Sjors
Copy link
Member

Sjors commented Jul 26, 2019

Did you try to build depends before installing the new headers? If you make clean in depends

I thought I did, but maybe not. I just tried make clean and now protobuf indeed just buids (on
536034b).

It'd say we wait with this.

If it doesn't break anything else, maybe we can do this bump when we bump QT to 5.12 (LTS)?

@fanquake fanquake force-pushed the macos-toolchain-update branch from 536034b to 7decfd4 Compare July 30, 2019 02:00
@fanquake
Copy link
Member Author

Updated to add some documentation (Linux) for the macOS 10.14 SDK extraction. This doesn't have to be the final docs, but should be useful for someone on a Linux machine wanting to extract the SDK and test this PR.

It'd say we wait with this.

We don't have to bump the minimum to 10.12 right now. We could do 10.11, or potentially leave it at 10.10 assuming there aren't any issues using the new SDK. Regardless, I'd like the rest of the changes (or at least the new Clang) to make it into v0.19.0, so that building for macOS isn't broken on Debian Buster #16052.

@Sjors
Copy link
Member

Sjors commented Aug 1, 2019

From Apple: "All Macintosh computers that can run Mountain Lion, Mavericks, or Yosemite can run El Capitan" (10.11). I suspect many people just don't realize they can upgrade.

I managed to build depends on macOS 10.14.6 (Mojave) with the minimum version set to 10.10

[...] may go away if we can remove any reliance on having the headers in the now deprecated location

That means this PR is not enough to support Catalina, at least not without some other workaround.

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the most part this looks great. I've added a few notes around libtapi which still needs a little work IMO.

I've not tried building yet, I'll work on getting an SDK extracted.

@@ -52,6 +67,9 @@ endef

define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install && \
mkdir -p $($(package)_staging_prefix_dir)/lib/ && \
cd $($(package)_extract_dir)/installed_libtapi && \
cp lib/libtapi.so.6 $($(package)_staging_prefix_dir)/lib/ && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want this built statically if possible, otherwise this introduces a (rather unnecessary) LDPATH runtime requirement. Does build.sh have static lib support?

@theuni
Copy link
Member

theuni commented Aug 2, 2019

I tested a few of my cleanup suggestions above, and they seem to work fine.
Feel free to pull the top two from here: https://github.com/theuni/bitcoin/commits/16392, or adapt them into your commits however's easiest.

@fanquake fanquake force-pushed the macos-toolchain-update branch from 7decfd4 to 97b3349 Compare August 5, 2019 03:47
@fanquake
Copy link
Member Author

fanquake commented Aug 5, 2019

@theuni I've incorporated some of your suggestions (trimming the LD64 stuff, and the clang hacks) and added you as co-author to the relevant commits.

We are now pointing back to upstream libdmg-hfsplus, with a single patch included in depends.

We are also now pointing back to the upstream cctools-port repo.

libtapi is now being built with our 6.0.1 Clang and I've removed one of the intermediate directories I was creating.

I still need to address:

We want this built statically if possible, otherwise this introduces a (rather unnecessary) LDPATH runtime requirement. Does build.sh have static lib support?

@Sjors
Copy link
Member

Sjors commented Aug 5, 2019

Building depends on macOS 10.14.6 Mojave still works as of 97b3349.

zkbot added a commit to zcash/zcash that referenced this pull request Jul 30, 2020
Modernise macOS cross-compilation toolchain

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#13617
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#17550
- bitcoin/bitcoin#16392
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#18589
- bitcoin/bitcoin#19240
- bitcoin/bitcoin#19407
- bitcoin/bitcoin#17919
  - Only the ancillary changes, not the `FORCE_USE_SYSTEM_CLANG` change.
- bitcoin/bitcoin#19530

After these changes, macOS versions earlier than 10.12 are no longer supported.

To cross-compile for macOS:
- Follow the instructions in `contrib/macdeploy/README.md` to generate
  `Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz`
  (requires an Apple Developer Account)
- Extract it into `depends/SDKs` (creating that folder first if it does not exist)
- `HOST=x86_64-apple-darwin16 ./zcutil/build.sh`
zkbot added a commit to zcash/zcash that referenced this pull request Aug 7, 2020
Modernise macOS cross-compilation toolchain

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#13617
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#17550
- bitcoin/bitcoin#16392
  - Excluding the QT GUI changes.
- bitcoin/bitcoin#18589
- bitcoin/bitcoin#19240
- bitcoin/bitcoin#19407
- bitcoin/bitcoin#17919
  - Only the ancillary changes, not the `FORCE_USE_SYSTEM_CLANG` change.
- bitcoin/bitcoin#19530

After these changes, macOS versions earlier than 10.12 are no longer supported.

To cross-compile for macOS:
- Follow the instructions in `contrib/macdeploy/README.md` to generate
  `Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz`
  (requires an Apple Developer Account)
- Extract it into `depends/SDKs` (creating that folder first if it does not exist)
- `HOST=x86_64-apple-darwin16 ./zcutil/build.sh`
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
7d7bf2f build: set minimum supported macOS to 10.12 (fanquake)

Pull request description:

  Extracted from bitcoin#16392 as this doesn't need to wait for the other build changes.

  Reasoning:
  * `10.10` has been unsupported since July 2017 (~3 years at `v0.20.0` release)
  * `10.11` has been unsupported since July 2018  (~2 years at `v0.20.0` release)
  * macOS users are consistent at upgrading to new releases.
  * Qt 5.12 LTS only supports [macOS > 10.12](https://doc-snapshots.qt.io/qt5-5.12/supported-platforms.html). As long as we're supporting macOS < 10.12 we would not be able to bump Qt in depends to 5.12 for the `v0.20.0` release.

  Once we drop support for 10.12 and start using the 10.15 SDK there are some other follow ups:
  * Enabling support for [`thread_local`](https://github.com/bitcoin/bitcoin/blob/master/configure.ac#L901).
  * Removing some of the macOS notification code
  * Removing macOS [startup item code](https://github.com/bitcoin/bitcoin/blob/master/src/qt/guiutil.cpp#L695).

  There was also some related discussion in the `#bitcoin-builds` channel yesterday arvo.

ACKs for top commit:
  laanwj:
    ACK 7d7bf2f
  dongcarl:
    post-IRC-grilling-ACK 7d7bf2f

Tree-SHA512: 30b0ed75e3b4df2d3f94db2091b7982c1ea7be8fb3a2732d8efd1a53ef1e492d7265a47e90c38e92f66e638d10e9400a6ecb56e5093688bb26d1621645b453e8
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
dc9305b random: don't special case clock usage on macOS (fanquake)

Pull request description:

  `clock_gettime()`, `CLOCK_MONOTONIC` and `CLOCK_REALTIME` are all available for use on
  macOS (now that we require macOS >=10.12 and build against 10.14). Use them rather than the [deprecated](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html) `mach_timespec_t` time API.

  I mentioned the possibility for this change [in bitcoin#17270](bitcoin#17270 (comment)).

  [master](1dbf335):
  ```bash
  2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
  2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG
  ```

  This PR:
  ```bash
  2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
  2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG
  ```

  ~~Depends on bitcoin#16392.~~ Merged.

ACKs for top commit:
  laanwj:
    ACK dc9305b

Tree-SHA512: 18c2f336ea628f9cf7339b817381d230a18893fd9c0351bf99a39ca6f45c5b0a20af9d599d48d6c09515627d5edafa91337c17f9f790264251d2cdcb3763bbd5
laanwj added a commit that referenced this pull request Dec 21, 2020
1fbb8b6 script: Remove outdated extract-osx-sdk.sh (Hennadii Stepanov)

Pull request description:

  The removed script was used to prepare `MacOSX10.11.sdk` which we do not use since 0.20 (7e21044 from #16392).

  See bitcoin-core/docs#68.

ACKs for top commit:
  laanwj:
    ACK 1fbb8b6

Tree-SHA512: ab5128ec2c505a43b1a12e06abf38d8fa8f62a03efe760de2c842550e82f68ca512dee1b6c220a4f8af2465a9c35a429ca91cb179cc4ce016fcd87c61fbc8b07
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 21, 2020
1fbb8b6 script: Remove outdated extract-osx-sdk.sh (Hennadii Stepanov)

Pull request description:

  The removed script was used to prepare `MacOSX10.11.sdk` which we do not use since 0.20 (bitcoin@7e21044 from bitcoin#16392).

  See bitcoin-core/docs#68.

ACKs for top commit:
  laanwj:
    ACK 1fbb8b6

Tree-SHA512: ab5128ec2c505a43b1a12e06abf38d8fa8f62a03efe760de2c842550e82f68ca512dee1b6c220a4f8af2465a9c35a429ca91cb179cc4ce016fcd87c61fbc8b07
furszy added a commit to PIVX-Project/PIVX that referenced this pull request May 25, 2021
e1b89ac Fix QPainter non-determinism on macOS (Andrew Chow)
831c317 macOS deploy: use the new plistlib API (Jonas Schnelli)
5857aaf doc: Document ALLOW_HOST_PACKAGES dependency option (skmcontrib)
2329e08 build: Fix behavior when ALLOW_HOST_PACKAGES unset (Hennadii Stepanov)
1768870 depends: native_ds_store 1.3.0 (fanquake)
3f9f3e5 depends: pull upstream libdmg-hfsplus changes (fanquake)
f7606dc depends: latest config.guess & config.sub (fanquake)
cc3ae74 depends: bump native_cctools for fixed lto with external clang (Cory Fields)
b26c648 depends: enable lto support for Apple's ld64 (Cory Fields)
50933d7 depends: Add documentation for FORCE_USE_SYSTEM_CLANG make flag (Carl Dong)
ba3ddf2 depends: Reformat make options as definition list (Carl Dong)
3b855a7 depends: Add justifications for macOS clang flags (Carl Dong)
4104de0 depends: specify libc++ header location for darwin (Cory Fields)
cd4335f depends: force a new host id string if FORCE_USE_SYSTEM_CLANG is in use (Cory Fields)
d30e1af depends: Allow building with system clang (Carl Dong)
234828b depends: Decouple toolchain + binutils (Carl Dong)
1dd3a5a doc: explain why passing -mlinker-version is required (fanquake)
5cc0d0f darwin: pass mlinker-version so that clang enables new features (Cory Fields)
813a552 macos: Bump to xcode 11.3.1 and 10.15 SDK (Cory Fields)
ee7085f depends: bump MacOS toolchain (Cory Fields)
e5b092b contrib: macdeploy: Remove historical extraction notes (Carl Dong)
5893caf contrib: macdeploy: Use apple-sdk-tools instead of xar+pbzx (Carl Dong)
9f2d4ba native_cctools: Don't use libc++ from pinned clang (Carl Dong)
0c8d217 Adapt rest of tooling to new SDK naming scheme (Carl Dong)
bdacfa8 contrib: macdeploy: Correctly generate macOS SDK (Carl Dong)
f7eee2c Fix naming of macOS SDK and clarify version (Andrew Chow)
62f9e23 build: use macOS 10.14 SDK (fanquake)
bc2e1af depends: native_cctools 921, ld64 409.12, libtapi 1000.10.8 (fanquake)
a296d87 depends: clang 6.0.1 (fanquake)
8f6c475 build: Set minimum supported macOS to 10.12 (Fuzzbawls)

Pull request description:

  This backports the following upstream PRs to update the macOS cross-compiling tools:

  bitcoin#17550
  bitcoin#16392
  bitcoin#18589
  bitcoin#19240
  bitcoin#19407
  bitcoin#17919
  bitcoin#19530
  bitcoin#17057
  bitcoin#20333
  bitcoin#18051
  bitcoin#19124
  bitcoin#20298
  bitcoin#20447

  The tools being updated are

  ### Clang
  Upgraded from `3.7.1` to `8.0.0`

  ### cctools

  * cctools `877.8` -> `949.0.1`
  * LD64 `253.9` -> `530`
  * TAPI `1000.10.8`

  ### DSStore
  Upgraded from `1.1.2` to `1.3.0` (this removes the biplist dependency)

  This also effectively bumps our minimum supported macOS version to 10.12 (Sierra).

ACKs for top commit:
  furszy:
    tested ACK e1b89ac
  random-zebra:
    utACK e1b89ac

Tree-SHA512: f5cec8db57e07d8855070646b9e1400d48aac1d01e3c2c3b3e134665c6372d6535f3328888bb9a75087f7b3d5231ecb4b509723bfa51bd40770ffe2810c67f65
kwvg added a commit to kwvg/dash that referenced this pull request Jul 15, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 15, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Jul 20, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 1, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 24, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 24, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 26, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 27, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 30, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 1, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 1, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

depends: Issue cross compiling for macOS on Debian Buster Bump macOS SDK version to 10.13 for gitian builds