Currently, on master (111c3e06b35b7867f2e0f740e988f648ac6c325d), dependencies are built for the build system architecture, not the provided host.
On Intel-based macOS Big Sur 11.6.1 (20G224):
0% make -C depends HOST=arm64-apple-darwin20
1% lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
2Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: x86_64
On M1-based macOS Monterey 12.0.1 (21A559) the boost
package building fails with multiple errors like that:
0% make -C depends boost HOST=x86_64-apple-darwin19
1...
2error: option 'cf-protection=return' cannot be specified on this target
3error: option 'cf-protection=branch' cannot be specified on this target
42 errors generated.
This PR allows to cross-compile as follows:
- on Intel-based macOS Big Sur 11.6.1 (20G224):
0% make -C depends HOST=arm64-apple-darwin20
1% lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
2Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
3% CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
4% make
5% lipo -info src/qt/bitcoin-qt
6Non-fat file: src/qt/bitcoin-qt is architecture: arm64
- on M1-based macOS Monterey 12.0.1 (21A559):
0% make -C depends HOST=x86_64-apple-darwin19
1% CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
2% make
3% lipo -info src/qt/bitcoin-qt
4Non-fat file: src/qt/bitcoin-qt is architecture: x86_64
No behavior change for other builder-host pairs.
This is an alternative to bitcoin/bitcoin#22506.