-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable macOS cross-compilation #4148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am able to build successfully and will continue testing on native Mac in the AM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
|
||
define $(package)_set_vars | ||
$(package)_config_opts=--target=$(host) --disable-lto-support | ||
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment explaining the escaping.
@@ -10,10 +10,12 @@ $(package)_sha256_hash_freebsd=20d062493d01f1816014fe9dbe883bda06f1828a6ddbfb7ee | |||
|
|||
# Mapping from GCC canonical hosts to Rust targets | |||
# If a mapping is not present, we assume they are identical | |||
$(package)_rust_target_x86_64-apple-darwin11=x86_64-apple-darwin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's this going to need to be continually updated for new macOS versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would add additional mappings to the same Rust target.
Re: bitcoin/bitcoin#9891 , an alternative would be to require the fixed version of ld64. |
When I tried to build it I ran into an error similar to this one, I worked around it by symlinking
I'm on Arch Linux. |
☔ The latest upstream changes (presumably #4160) made this pull request unmergeable. Please resolve the merge conflicts. |
…ntly use." This partially reverts commit 86551dc to bring back native_cctools for cross-compiling macOS.
Checksums were being verified after download, but not again before extraction Zcash: Only cctools changes
clang: 3.7.1 cctools: 877.8 ld64: 253.9 Zcash: Second part of f25209a from upstream (we merged the first part in zcash#2697).
ld64 is threaded, and uses a worker for each CPU to parse input files. But there's a bug in the parser causing dependencies to be calculated differently based on which files have already been parsed. As a result, builders with more CPUs are more likely to see non-determinism. This looks to have been fixed in a newer version of ld64, so just disable threading for now. There's no noticible slowdown.
For normal users, --no-same-owner is default, but not so for root, where it is assumed that root can change ownership willy-nilly. This is not the case for privilege-limited container environments where we gaslight the process into thinking it's root. Zcash: Excludes QT changes
Some dependency sources were downloaded via http, even though https (SSL/TLS) options are available. Even if we potentially check the integrity of the downloaded files via hash comparison, we should make use of this additional security layer. Zcash: native_cctools.mk
This sidesteps the problem where the atomics check tries to run a test binary, which cannot be performed during cross compilation. We should replace this with a better solution in future. Part of zcash#3710.
The build environment is applied to the entire configured build_cmds section, but it doesn't carry over past the && between the gmock and gtest builds. This causes problems when cross-compiling for darwin, as the correctly-configured clang++ is provided in the build environment.
3c13a99
to
adb4748
Compare
Rebased to fix merge conflict (i.e. update Rust version).
I don't think we need to support cross-compiling from every Linux platform; as long as it can be done from our usual Debian-based platforms then I think this is sufficient. I confirmed that I can build this branch on Ubuntu 18.04.3 LTS inside WSL. I do get a bunch of ld warnings:
but the binaries are built and linked, so we can figure the above out later. |
testACK for ARM (from ubuntu 18.04 and 19.04 ):
Important note: Binary used from ubuntu 19.04 does not work on bare metal ARM64, however the binary from the Ubuntu 18.04 system runs on bare metal ARM64...ODROID N2 syncing now on mainnet for Blossom |
testACK for MacOS cross compile (from ubuntu 18.04; ubuntu 19.04 failed to cross compile for Mac):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testedACK ; see comments above on specifics for worker pool update
@zkbot r+ |
📌 Commit adb4748 has been approved by |
Enable macOS cross-compilation Includes code cherry-picked from the following upstream PRs: - bitcoin/bitcoin#7809 - The `native_cctools` fix. - bitcoin/bitcoin#8210 - The macOS toolchain bump. - bitcoin/bitcoin#9891 - bitcoin/bitcoin#15581 - The `tar` change. - bitcoin/bitcoin#16049 - The `native_cctools` change. Build instructions: - Fetch `MacOSX10.11.sdk` from e.g. https://github.com/phracker/MacOSX-SDKs/releases - Extract it into `depends/SDKs` (creating that folder first) - `HOST=x86_64-apple-darwin11 ./zcutil/build.sh`
To fix those linker warnings, I think you need to add either Here are the Apple docs for those options: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html |
Includes code cherry-picked from the following upstream PRs:
native_cctools
fix.tar
change.native_cctools
change.Build instructions:
MacOSX10.11.sdk
from e.g. https://github.com/phracker/MacOSX-SDKs/releasesdepends/SDKs
(creating that folder first)HOST=x86_64-apple-darwin11 ./zcutil/build.sh