Skip to content
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

build: Support x86_64 <-> arm64 cross-compiling for macOS #22506

Closed
wants to merge 3 commits into from

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jul 20, 2021

Currently, on master (681b25e), dependencies are built for the build system architecture, not the provided host.

On Intel-based macOS Big Sur 11.6.1 (20G224):

% make -C depends HOST=arm64-apple-darwin20
% lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a 
Non-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:

% make -C depends boost HOST=x86_64-apple-darwin19
...
error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target
2 errors generated.

This PR allows to cross-compile as follows:

  • on Intel-based macOS Big Sur 11.6.1 (20G224):
% make -C depends HOST=arm64-apple-darwin20
% lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a 
Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
% CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
% make
% lipo -info src/qt/bitcoin-qt 
Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  • on M1-based macOS Monterey 12.0.1 (21A559):
% make -C depends HOST=x86_64-apple-darwin19
% CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
% make
% lipo -info src/qt/bitcoin-qt
Non-fat file: src/qt/bitcoin-qt is architecture: x86_64

No behavior change for other builder-host pairs.

@hebasto
Copy link
Member Author

hebasto commented Jul 20, 2021

cc @promag @jarolrod @fanquake

@@ -125,6 +125,11 @@ $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSIO
$(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-"
$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION)
else
ifneq ($(host_arch),$(build_arch))
Copy link
Member

Choose a reason for hiding this comment

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

Haven't looked at this other than to say, if this is explicitly fixing the NO_QT=1 build, why is it touching Qt code.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason to include this change here is to do not change build system behavior while building without NO_QT=1:

  • on Intel-based macOS 11.4
  • on M1-based macOS with installed Rosetta 2

Copy link
Member

Choose a reason for hiding this comment

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

the "darwin" comes out of the blue here, it's not in a MacOS specific block, ($(host_arch),$(build_arch)) is not specifically related to it and might arise on different systems as well when cross-compiling

Copy link
Member Author

@hebasto hebasto Sep 9, 2021

Choose a reason for hiding this comment

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

the "darwin" comes out of the blue here...

These lines are placed within the else branch of the ifneq ($(build_os),darwin) statement.

@RandyMcMillan
Copy link
Contributor

RandyMcMillan commented Jul 22, 2021

Tested 3bf2fa5 macOS 11.4 arm64

Remote Desktop Picture July 22, 2021 at 9 40 50 AM EDT

@hebasto
Copy link
Member Author

hebasto commented Jul 23, 2021

Rebased 3bf2fa5 -> b419da7 (pr22506.01 -> pr22506.02) due to the conflict with #22526.

@RandyMcMillan
Copy link
Contributor

Remote Desktop Picture July 26, 2021 at 7 24 27 PM EDT

Tested your in scope commits together ->
hebasto-mac-prs

@hebasto
Copy link
Member Author

hebasto commented Aug 3, 2021

Rebased b419da7 -> aacb8fe (pr22506.02 -> pr22506.03) due to the conflict with #22448.

Also the PR description has been updated.

@hebasto
Copy link
Member Author

hebasto commented Aug 3, 2021

Guix builds:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
1190773d43326d653f6fe5a0287f60283f7030c07fe301b602e5835bfaf10ddf  guix-build-aacb8fef335c/output/aarch64-linux-gnu/SHA256SUMS.part
c05e6f7b1838616379eb7530e25bc5c642beb8557a8b50cd0495b4c9fac5c4a9  guix-build-aacb8fef335c/output/aarch64-linux-gnu/bitcoin-aacb8fef335c-aarch64-linux-gnu-debug.tar.gz
bddcda9e9c9e216984dfb3fdfa1f4210ff213b0e5c5da70504c358c34bcc277b  guix-build-aacb8fef335c/output/aarch64-linux-gnu/bitcoin-aacb8fef335c-aarch64-linux-gnu.tar.gz
917352ea95ac8a659974e15355bd4c4eb1ead93bf652c54c0d3651d7d4d0e383  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/SHA256SUMS.part
8627a129a2a25fb8ab2651cbee164ef421e0d047c4bec81c46323818c69a65bf  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/bitcoin-aacb8fef335c-arm-linux-gnueabihf-debug.tar.gz
fd12df131f4acd91dfbc7f58291803a08a2efe861cb5c099d515fa06d9b898bd  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/bitcoin-aacb8fef335c-arm-linux-gnueabihf.tar.gz
7ca3783ecf48dcbedd1671872d0d194c8625acf0c9239b63828ef4002461087e  guix-build-aacb8fef335c/output/dist-archive/bitcoin-aacb8fef335c.tar.gz
a519b5aa1017b3b4d6633eab527635c439b91a497c4168202f46f8d299128375  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/SHA256SUMS.part
b50132d6746c7ef2ed014e311ba32d7427695017d9e9e80c4fa2819f6b2cfdb5  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/bitcoin-aacb8fef335c-powerpc64-linux-gnu-debug.tar.gz
d867a238aaf5e7ab08084a57ea1746c27dcb7ab8649eb42cc97c90060beacfad  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/bitcoin-aacb8fef335c-powerpc64-linux-gnu.tar.gz
b3ca59a31b1c243798cd28ae47342a4c79495f8b71180004a452d059bb41a731  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/SHA256SUMS.part
2ddd48743495c2b973299d0abbe656c0000a7a92cc9f930623d1895b1d7cb7e4  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/bitcoin-aacb8fef335c-powerpc64le-linux-gnu-debug.tar.gz
160d166a471c10c111c257bd6092513dda39df40837e7dbc8cf697b8d8119507  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/bitcoin-aacb8fef335c-powerpc64le-linux-gnu.tar.gz
2f67dddf895c688ee869a96a0bad72c5f85efd077004caaf5ee5fb15bafb3203  guix-build-aacb8fef335c/output/riscv64-linux-gnu/SHA256SUMS.part
1caed52fc8769e096a954c87f9cf9d681f7d1edec1a977e1f88e6a761eae2c85  guix-build-aacb8fef335c/output/riscv64-linux-gnu/bitcoin-aacb8fef335c-riscv64-linux-gnu-debug.tar.gz
c1bfe936416bd1fa065cfa7fd203ba01e7b004b79ca3edd7e6aa33c31d10b6dd  guix-build-aacb8fef335c/output/riscv64-linux-gnu/bitcoin-aacb8fef335c-riscv64-linux-gnu.tar.gz
9267c57a4059f595cb2c3e62c04e1574d711095ba9a808b2564f982767784eb8  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/SHA256SUMS.part
80c4a5c21be0a8b3dcf6b2e7392a7dc5ae7bce8405af360c1a553ba496803b21  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx-unsigned.dmg
e017410c877b022c34233c78d9464c0955e5b4fe528cd278667ad1f4cc427749  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx-unsigned.tar.gz
06e47fbdf0804ccb6e39a20e4ceef2328f2735bdb893fc8d51023f6473d5ed8c  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx64.tar.gz
eae8fb65ba1b986f8512b3b055f157aad63376085f5b21b8fb50d220800a80b8  guix-build-aacb8fef335c/output/x86_64-linux-gnu/SHA256SUMS.part
563fefe18d29d951931185e344d0d8baab9ad27d816609777a6c491d8d6753f0  guix-build-aacb8fef335c/output/x86_64-linux-gnu/bitcoin-aacb8fef335c-x86_64-linux-gnu-debug.tar.gz
d42058eecc7d249f46dbd9257fb0b0a6f7025cb3948a3175c981c7c7286414a5  guix-build-aacb8fef335c/output/x86_64-linux-gnu/bitcoin-aacb8fef335c-x86_64-linux-gnu.tar.gz
f480c3604a83b44aadb9a3b2996c74f4c6843c7ee93e563ceabb2e83b02fb45f  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/SHA256SUMS.part
0d9091632b60c15edae8e8e8edf39c841ee8381038fa743bb58c307e8c000907  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win-unsigned.tar.gz
1c9dd53b6407e0a0218eacb102c0b35a9e97ca46d8c64d4baf02933c7fb112dc  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64-debug.zip
ff8d020e9aa496f602fb48b2a250e68ac1d06cd7e9139dd69d6b14d8cf1a7c31  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64-setup-unsigned.exe
c2e965fb3804f912bfa45be054d28cfed0867ed6c2ec898acdae9b578170c608  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64.zip

@jarolrod
Copy link
Member

GUIX hashes, mine match @hebasto :

find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum

1190773d43326d653f6fe5a0287f60283f7030c07fe301b602e5835bfaf10ddf  guix-build-aacb8fef335c/output/aarch64-linux-gnu/SHA256SUMS.part
c05e6f7b1838616379eb7530e25bc5c642beb8557a8b50cd0495b4c9fac5c4a9  guix-build-aacb8fef335c/output/aarch64-linux-gnu/bitcoin-aacb8fef335c-aarch64-linux-gnu-debug.tar.gz
bddcda9e9c9e216984dfb3fdfa1f4210ff213b0e5c5da70504c358c34bcc277b  guix-build-aacb8fef335c/output/aarch64-linux-gnu/bitcoin-aacb8fef335c-aarch64-linux-gnu.tar.gz
917352ea95ac8a659974e15355bd4c4eb1ead93bf652c54c0d3651d7d4d0e383  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/SHA256SUMS.part
8627a129a2a25fb8ab2651cbee164ef421e0d047c4bec81c46323818c69a65bf  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/bitcoin-aacb8fef335c-arm-linux-gnueabihf-debug.tar.gz
fd12df131f4acd91dfbc7f58291803a08a2efe861cb5c099d515fa06d9b898bd  guix-build-aacb8fef335c/output/arm-linux-gnueabihf/bitcoin-aacb8fef335c-arm-linux-gnueabihf.tar.gz
7ca3783ecf48dcbedd1671872d0d194c8625acf0c9239b63828ef4002461087e  guix-build-aacb8fef335c/output/dist-archive/bitcoin-aacb8fef335c.tar.gz
a519b5aa1017b3b4d6633eab527635c439b91a497c4168202f46f8d299128375  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/SHA256SUMS.part
b50132d6746c7ef2ed014e311ba32d7427695017d9e9e80c4fa2819f6b2cfdb5  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/bitcoin-aacb8fef335c-powerpc64-linux-gnu-debug.tar.gz
d867a238aaf5e7ab08084a57ea1746c27dcb7ab8649eb42cc97c90060beacfad  guix-build-aacb8fef335c/output/powerpc64-linux-gnu/bitcoin-aacb8fef335c-powerpc64-linux-gnu.tar.gz
b3ca59a31b1c243798cd28ae47342a4c79495f8b71180004a452d059bb41a731  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/SHA256SUMS.part
2ddd48743495c2b973299d0abbe656c0000a7a92cc9f930623d1895b1d7cb7e4  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/bitcoin-aacb8fef335c-powerpc64le-linux-gnu-debug.tar.gz
160d166a471c10c111c257bd6092513dda39df40837e7dbc8cf697b8d8119507  guix-build-aacb8fef335c/output/powerpc64le-linux-gnu/bitcoin-aacb8fef335c-powerpc64le-linux-gnu.tar.gz
2f67dddf895c688ee869a96a0bad72c5f85efd077004caaf5ee5fb15bafb3203  guix-build-aacb8fef335c/output/riscv64-linux-gnu/SHA256SUMS.part
1caed52fc8769e096a954c87f9cf9d681f7d1edec1a977e1f88e6a761eae2c85  guix-build-aacb8fef335c/output/riscv64-linux-gnu/bitcoin-aacb8fef335c-riscv64-linux-gnu-debug.tar.gz
c1bfe936416bd1fa065cfa7fd203ba01e7b004b79ca3edd7e6aa33c31d10b6dd  guix-build-aacb8fef335c/output/riscv64-linux-gnu/bitcoin-aacb8fef335c-riscv64-linux-gnu.tar.gz
9267c57a4059f595cb2c3e62c04e1574d711095ba9a808b2564f982767784eb8  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/SHA256SUMS.part
80c4a5c21be0a8b3dcf6b2e7392a7dc5ae7bce8405af360c1a553ba496803b21  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx-unsigned.dmg
e017410c877b022c34233c78d9464c0955e5b4fe528cd278667ad1f4cc427749  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx-unsigned.tar.gz
06e47fbdf0804ccb6e39a20e4ceef2328f2735bdb893fc8d51023f6473d5ed8c  guix-build-aacb8fef335c/output/x86_64-apple-darwin18/bitcoin-aacb8fef335c-osx64.tar.gz
eae8fb65ba1b986f8512b3b055f157aad63376085f5b21b8fb50d220800a80b8  guix-build-aacb8fef335c/output/x86_64-linux-gnu/SHA256SUMS.part
563fefe18d29d951931185e344d0d8baab9ad27d816609777a6c491d8d6753f0  guix-build-aacb8fef335c/output/x86_64-linux-gnu/bitcoin-aacb8fef335c-x86_64-linux-gnu-debug.tar.gz
d42058eecc7d249f46dbd9257fb0b0a6f7025cb3948a3175c981c7c7286414a5  guix-build-aacb8fef335c/output/x86_64-linux-gnu/bitcoin-aacb8fef335c-x86_64-linux-gnu.tar.gz
f480c3604a83b44aadb9a3b2996c74f4c6843c7ee93e563ceabb2e83b02fb45f  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/SHA256SUMS.part
0d9091632b60c15edae8e8e8edf39c841ee8381038fa743bb58c307e8c000907  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win-unsigned.tar.gz
1c9dd53b6407e0a0218eacb102c0b35a9e97ca46d8c64d4baf02933c7fb112dc  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64-debug.zip
ff8d020e9aa496f602fb48b2a250e68ac1d06cd7e9139dd69d6b14d8cf1a7c31  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64-setup-unsigned.exe
c2e965fb3804f912bfa45be054d28cfed0867ed6c2ec898acdae9b578170c608  guix-build-aacb8fef335c/output/x86_64-w64-mingw32/bitcoin-aacb8fef335c-win64.zip

@laanwj
Copy link
Member

laanwj commented Sep 9, 2021

I think this cross-compilation configuration should be supported, but I'm not sure the changes here are correct. I wonder if it can be handled in a more general way as well, that doesn't need to special-case Darwin inside package builds.

@hebasto
Copy link
Member Author

hebasto commented Sep 9, 2021

I think this cross-compilation configuration should be supported, but I'm not sure the changes here are correct. I wonder if it can be handled in a more general way as well, that doesn't need to special-case Darwin inside package builds.

This PR just adds the else branch to the already existed Darwin-specific block, no?

@hebasto hebasto marked this pull request as draft November 23, 2021 15:04
@fanquake
Copy link
Member

Please un-draft and rebase this, as well as update the PR description.

@hebasto hebasto marked this pull request as ready for review November 25, 2021 12:47
@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2021

Rebased aacb8fe -> 46cf787 (pr22506.03 -> pr22506.04) on top of the #23583.

Also the PR description has been updated.

@fanquake

Please un-draft and rebase this, as well as update the PR description.

Done 🐅

@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2021

@laanwj

I think this cross-compilation configuration should be supported, but I'm not sure the changes here are correct. I wonder if it can be handled in a more general way as well, that doesn't need to special-case Darwin inside package builds.

I've made more research, and figured out that a general approach breaks cross compiling on linux for macos due to our custom macx-clang-linux mkspec. So I left the code unchanged, and added a comment.

@@ -10,8 +10,10 @@ build_darwin_SHA256SUM=shasum -a 256
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

#darwin host on darwin builder. overrides darwin host preferences.
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -isysroot$(shell xcrun --show-sdk-path)
Copy link
Member

Choose a reason for hiding this comment

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

Can you maintain the surrounding style until we eitherr commit to a new one, and/or change things wholesale. Otherwise depends is becoming a bit of a mis-mash, and potentially just more confusing to those who aren't familiar with it.

@@ -126,6 +126,15 @@ $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSIO
$(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-"
$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION)
else
# Qt must be able to build its own tools for the build platform.
Copy link
Member

Choose a reason for hiding this comment

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

I'm having trouble parsing this comment. Can you describe the actual problem? What about the custom mkspec is the issue?

@hebasto
Copy link
Member Author

hebasto commented Nov 25, 2021

Guix builds:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
d8eef09fbee959ae2814239686e240d5ed22820e61b375e646d8e5e6c6d6953e  guix-build-46cf7877e404/output/aarch64-linux-gnu/SHA256SUMS.part
406427d4fdb4553cbc806a6fb50b3af0846a70a1081f05df66292697b80150f7  guix-build-46cf7877e404/output/aarch64-linux-gnu/bitcoin-46cf7877e404-aarch64-linux-gnu-debug.tar.gz
5e3639a46fdea62a955323c20985f6984eb931c9c232ada12f31b5070c18047f  guix-build-46cf7877e404/output/aarch64-linux-gnu/bitcoin-46cf7877e404-aarch64-linux-gnu.tar.gz
073e70aadd175c50f241d86f14cf612ea41607cc8972c75d845234ff5e8ff9e7  guix-build-46cf7877e404/output/arm-linux-gnueabihf/SHA256SUMS.part
c1046aaf6f1705bb7ad563e1713b44ee809d830640a9abc128d6591a44b5428b  guix-build-46cf7877e404/output/arm-linux-gnueabihf/bitcoin-46cf7877e404-arm-linux-gnueabihf-debug.tar.gz
ac625f6ec5bb2e85b862ef50453cf28278bb3558d30a2d07f447af8b6073c9a8  guix-build-46cf7877e404/output/arm-linux-gnueabihf/bitcoin-46cf7877e404-arm-linux-gnueabihf.tar.gz
55273938cd29aface8315da947e5360f2e88d9acf0190360024e46bd3758651c  guix-build-46cf7877e404/output/dist-archive/bitcoin-46cf7877e404.tar.gz
2bbaaa648d5be9d85e0214bd73584a5c6e22876de83645db2b05d8f329409003  guix-build-46cf7877e404/output/powerpc64-linux-gnu/SHA256SUMS.part
2a776354e6d23233d3305295bb0b5e0929a3f434bfec1d39622f991f3f1b54a5  guix-build-46cf7877e404/output/powerpc64-linux-gnu/bitcoin-46cf7877e404-powerpc64-linux-gnu-debug.tar.gz
80e48cb6b4080997fe6f80652f876933d47e87ed862a7b02f81f21b8158ce561  guix-build-46cf7877e404/output/powerpc64-linux-gnu/bitcoin-46cf7877e404-powerpc64-linux-gnu.tar.gz
7c7c18be7eb1e0391115e6c9b0008b0173d7f3bea268c67333c5f7eea485b5d1  guix-build-46cf7877e404/output/powerpc64le-linux-gnu/SHA256SUMS.part
44c6f67bd690edb7d70562af0d9abc8a1595b71caef479f29dbb67314934b822  guix-build-46cf7877e404/output/powerpc64le-linux-gnu/bitcoin-46cf7877e404-powerpc64le-linux-gnu-debug.tar.gz
0936eb7ddd8e198b64b9f767fe7f0da362a09334b4b8956777b18b764f2bea6b  guix-build-46cf7877e404/output/powerpc64le-linux-gnu/bitcoin-46cf7877e404-powerpc64le-linux-gnu.tar.gz
3b3b5a079923ca7d9af252803c2f0b13198d1e9e2f8a327f59838b3c36cd7af7  guix-build-46cf7877e404/output/riscv64-linux-gnu/SHA256SUMS.part
4dcb51322bcb3ad352e5c18d9875b6405c0b1b162fd811d1544aaf9108ff4ace  guix-build-46cf7877e404/output/riscv64-linux-gnu/bitcoin-46cf7877e404-riscv64-linux-gnu-debug.tar.gz
03b30c76a4e29f0275dc43895fce7652259ae086538ad67327b33d07e097173e  guix-build-46cf7877e404/output/riscv64-linux-gnu/bitcoin-46cf7877e404-riscv64-linux-gnu.tar.gz
e956ff0d06208a2474bf0e4b97712da0b40f04230916d3ae3218004f26ced075  guix-build-46cf7877e404/output/x86_64-apple-darwin19/SHA256SUMS.part
995f198f8c9d2870019b8d050233657087d141f08992059572121a4c44f1522b  guix-build-46cf7877e404/output/x86_64-apple-darwin19/bitcoin-46cf7877e404-osx-unsigned.dmg
66154ea9b6211c37c4ce8f7784f2e029b6094c3920c8f4e01bda9dfb0163e22e  guix-build-46cf7877e404/output/x86_64-apple-darwin19/bitcoin-46cf7877e404-osx-unsigned.tar.gz
055edaf1653b17cc0c1e5b476be39dd9e7e89b5367cb310453f53565f287b52f  guix-build-46cf7877e404/output/x86_64-apple-darwin19/bitcoin-46cf7877e404-osx64.tar.gz
6ef9779635c16561f3098125b51db66809bfed1043dc34ca43e1e82ce316e170  guix-build-46cf7877e404/output/x86_64-linux-gnu/SHA256SUMS.part
b110c22d37e273d039d746af61bddf6d0d647ca4c0cf1e765f46d0b99eb6723f  guix-build-46cf7877e404/output/x86_64-linux-gnu/bitcoin-46cf7877e404-x86_64-linux-gnu-debug.tar.gz
63363ad130efe472569412ce3c49a5a4af8db5128edacb6cc8765b5d32253ad4  guix-build-46cf7877e404/output/x86_64-linux-gnu/bitcoin-46cf7877e404-x86_64-linux-gnu.tar.gz
a28b306e6b608b2d08b729835fc3e1b281f19577138977e7e33c6f4a36907ea2  guix-build-46cf7877e404/output/x86_64-w64-mingw32/SHA256SUMS.part
94e61c19d8d0b4bcbfec2e93739a21a4b6610d0b779a58aa431c100ae0e25b7b  guix-build-46cf7877e404/output/x86_64-w64-mingw32/bitcoin-46cf7877e404-win-unsigned.tar.gz
3a5fa3ecb9da6b11d01d751baf62de3c15a110c95b0e13704de084d7aa9919f0  guix-build-46cf7877e404/output/x86_64-w64-mingw32/bitcoin-46cf7877e404-win64-debug.zip
11ba6efa90c816d30bc2e263ec851a4e387d069797cf540dc1c5a15d644ae7d6  guix-build-46cf7877e404/output/x86_64-w64-mingw32/bitcoin-46cf7877e404-win64-setup-unsigned.exe
2bc6d4d472cdab3fca5131a7b3393d25a2e1b2eec6110765f96a43927ab7a4c4  guix-build-46cf7877e404/output/x86_64-w64-mingw32/bitcoin-46cf7877e404-win64.zip

This change fixes cross-compiling on M1 Apple Silicon systems.
@hebasto
Copy link
Member Author

hebasto commented Nov 26, 2021

Closing in favor of #23603.

@hebasto hebasto closed this Nov 26, 2021
@hebasto hebasto deleted the 210720-xmac branch November 26, 2021 12:59
@DrahtBot
Copy link
Contributor

Guix builds

File commit 681b25e
(master)
commit 20ed954
(master and this pull)
SHA256SUMS.part 3adc72d019c8264f... 9059f2369894fc8e...
*-aarch64-linux-gnu-debug.tar.gz a88546e7d3fa62b1... b8bd263dd4f11be6...
*-aarch64-linux-gnu.tar.gz d5aad5b2687bc695... 922057a3b054145f...
*-arm-linux-gnueabihf-debug.tar.gz c0f6f3a2d336bc43... afb53fb81a0cd2ad...
*-arm-linux-gnueabihf.tar.gz 28718e0018334656... 7a0488a9eacbec33...
*-osx-unsigned.dmg a13ab48381c0599e... 174d30a6ba9ec183...
*-osx-unsigned.tar.gz ca084adb58b06835... 160fc1ea07860e5c...
*-osx64.tar.gz 189e11d1f4673236... 42a6c3b4a36dea2b...
*-powerpc64-linux-gnu-debug.tar.gz 71717a29142ce631... 0bd8efe0ff577d18...
*-powerpc64-linux-gnu.tar.gz f948d725e1c7ea8b... 16a0381c274d5a51...
*-powerpc64le-linux-gnu-debug.tar.gz c59343e6e09a4aba... 1a040d8385c4b57c...
*-powerpc64le-linux-gnu.tar.gz 066efbd7432a166f... dcf2e1809935048d...
*-riscv64-linux-gnu-debug.tar.gz 244902591b418cbe... 871ea7b5bc8a0107...
*-riscv64-linux-gnu.tar.gz 593c31a1ad5feda5... ce02945f8bd5d358...
*-win-unsigned.tar.gz 0e2496ccb7019626... bb2007ca2666fbab...
*-win64-debug.zip d16485a58437001d... 76a83eb6feaa79c6...
*-win64-setup-unsigned.exe 7c15f9ba9983aa5b... c56c83ac2b476b5d...
*-win64.zip fdd989684413d832... b76bddbb220ff543...
*-x86_64-linux-gnu-debug.tar.gz b2637cc3bd0def85... 3245dd5bfb39494f...
*-x86_64-linux-gnu.tar.gz 48fe94a84d3a60bc... b61f02269bdf22a1...
*.tar.gz 7648d125741efb63... 3b59136d7097863c...
guix_build.log d87a69ee3014c34c... 04fc307ce1d7af35...
guix_build.log.diff a44f9ba52cb7f9aa...

fanquake added a commit to bitcoin-core/gui that referenced this pull request Dec 9, 2021
…ing for macOS

19f3896 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (111c3e0), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-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.

ACKs for top commit:
  fanquake:
    ACK 19f3896 - this is definitely cleaner than the approach in #22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 10, 2021
…macOS

19f3896 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (111c3e0), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: x86_64
  ```

  No behavior change for other builder-host pairs.

  This is an alternative to bitcoin#22506.

ACKs for top commit:
  fanquake:
    ACK 19f3896 - this is definitely cleaner than the approach in bitcoin#22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
RandyMcMillan pushed a commit to RandyMcMillan/mempool-tab that referenced this pull request Dec 23, 2021
…ing for macOS

ad46528 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (e475dd3), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-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.

ACKs for top commit:
  fanquake:
    ACK ad46528 - this is definitely cleaner than the approach in #22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 7, 2022
…macOS

19f3896 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (111c3e0), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: x86_64
  ```

  No behavior change for other builder-host pairs.

  This is an alternative to bitcoin#22506.

ACKs for top commit:
  fanquake:
    ACK 19f3896 - this is definitely cleaner than the approach in bitcoin#22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 7, 2022
…macOS

19f3896 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (111c3e0), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: x86_64
  ```

  No behavior change for other builder-host pairs.

  This is an alternative to bitcoin#22506.

ACKs for top commit:
  fanquake:
    ACK 19f3896 - this is definitely cleaner than the approach in bitcoin#22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 7, 2022
…macOS

19f3896 build: Fix x86_64 <-> arm64 cross-compiling for macOS (Hennadii Stepanov)

Pull request description:

  Currently, on master (111c3e0), dependencies are built for the build system architecture, not the provided host.

  On Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-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:
  ```
  % make -C depends boost HOST=x86_64-apple-darwin19
  ...
  error: option 'cf-protection=return' cannot be specified on this target
  error: option 'cf-protection=branch' cannot be specified on this target
  2 errors generated.
  ```

  This PR allows to cross-compile as follows:
  - on Intel-based macOS Big Sur 11.6.1 (20G224):
  ```
  % make -C depends HOST=arm64-apple-darwin20
  % lipo -info depends/arm64-apple-darwin20/lib/libsqlite3.a
  Non-fat file: depends/arm64-apple-darwin20/lib/libsqlite3.a is architecture: arm64
  % CONFIG_SITE=$PWD/depends/arm64-apple-darwin20/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: arm64
  ```

  - on M1-based macOS Monterey 12.0.1 (21A559):
  ```
  % make -C depends HOST=x86_64-apple-darwin19
  % CONFIG_SITE=$PWD/depends/x86_64-apple-darwin19/share/config.site ./configure
  % make
  % lipo -info src/qt/bitcoin-qt
  Non-fat file: src/qt/bitcoin-qt is architecture: x86_64
  ```

  No behavior change for other builder-host pairs.

  This is an alternative to bitcoin#22506.

ACKs for top commit:
  fanquake:
    ACK 19f3896 - this is definitely cleaner than the approach in bitcoin#22506. I've tested the x86_64 -> arm64 and arm64 -> x86_64 cross-compiles. Going to go-ahead and merge this given it's scoped to building for darwin targets, on darwin. Not sure if this is something we'll actually see used very often.

Tree-SHA512: 67a7fed1db79bc43d41aabb5a676f90417a879e5dcffec1384c288b56ee32ba06ae3819abdc7aca85b81af6e782bcfff5c83a67a455560249fa095a807fc1187
@bitcoin bitcoin locked and limited conversation to collaborators Nov 27, 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.

7 participants