bitcoin/depends
fanquake a4f7c41271
Merge bitcoin/bitcoin#21851: release: support cross-compiling for arm64-apple-darwin
edd70b52fc doc: add arm macOS depends platform triplet (jarolrod)
0628815e95 guix: add arm64-apple-darwin triplet (fanquake)
ca47f2e211 guix: use autoconf 2.71 (fanquake)
6fe55160dd contrib: support arm64 darwin in security checks (fanquake)
446e73cc0b build: use macOS 11 SDK (Xcode 12.2) (fanquake)

Pull request description:

  With a few minor changes, our macOS toolchain, and Guix, supports building for `arm64-apple-darwin` (Apple M1). Newer [`config.guess`](https://git.savannah.gnu.org/cgit/config.git/plain/config.guess) and [`config.sub`](https://git.savannah.gnu.org/cgit/config.git/plain/config.sub) are required (via autoconf 2.71), as support for recognising `arm64-apple-darwin` [was only recently added](https://git.savannah.gnu.org/cgit/config.git/commit/?id=2593751ef276497e312d7c4ce7fd049614c7bf80). A newer version of the macOS SDK (11.0+) is also required; I've taken this from Xcode 12.2.

  Guix Build:
  ```bash
  bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
  c9c64c6252927c82d4a96eb2b1a13c557ac230afa3640a7f2feec87fabe2b7e5  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/SHA256SUMS.part
  b57dd461ec6a0b22ce9614ab824bcbff4c3e6e935c22367aff9a718f46c3fd39  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/bitcoin-edd70b52fcd7-aarch64-linux-gnu-debug.tar.gz
  66da9f57a6789108db3460d2b54a8bed68b7e147627404e51f66254d91500402  guix-build-edd70b52fcd7/output/aarch64-linux-gnu/bitcoin-edd70b52fcd7-aarch64-linux-gnu.tar.gz
  13213523984837fc66fe27cc4dac269f6ef554ec56316af92337f4c4845f6acf  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/SHA256SUMS.part
  e1a17b41c92879ccb6608a6a6f82aac22d999f10d798f40f96297d91ebd90d20  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/bitcoin-edd70b52fcd7-arm-linux-gnueabihf-debug.tar.gz
  6a6d54081c2dd8f9a44293275aea875587b5fa7cc31a30925fb5156bb1e55bf3  guix-build-edd70b52fcd7/output/arm-linux-gnueabihf/bitcoin-edd70b52fcd7-arm-linux-gnueabihf.tar.gz
  79f617a2f0a11e6a8fcf8058e05204a374ab5f689ccb15a2ff449ee2dd5e8216  guix-build-edd70b52fcd7/output/arm64-apple-darwin/SHA256SUMS.part
  6fb04a18b17812174ec35a6788dce5745d6c2dec558056dcfdd356b57d089b99  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-arm64-apple-darwin.tar.gz
  a67e415631bea940adab86adec9899593fa35e1773d4ac1149efd249adf89996  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.dmg
  2a41c273afb8bb621226de80302a7190eee057c2447d113999f40a9485430d44  guix-build-edd70b52fcd7/output/arm64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.tar.gz
  c8d9358471e1d72d56122ae6f53dc2a42ae0925628bf347acd1a3ae7110d8759  guix-build-edd70b52fcd7/output/dist-archive/bitcoin-edd70b52fcd7.tar.gz
  1985a4869307418ec2ee85f5f0ccfea0944eba0792318a8676ae213a9589ed97  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/SHA256SUMS.part
  6a1d3525011da84e24997c9ab39563b3597ae881b4d1af5a09a6e673cfc59808  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/bitcoin-edd70b52fcd7-powerpc64-linux-gnu-debug.tar.gz
  cda50c28b2920caef74de4b3e78fd4d81592d1aadc9758d1882f1cad16dc83ca  guix-build-edd70b52fcd7/output/powerpc64-linux-gnu/bitcoin-edd70b52fcd7-powerpc64-linux-gnu.tar.gz
  ca92936cf796543d13250f94175af772a9fc985e834017d6af2cfb36eea289e6  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/SHA256SUMS.part
  64c46248065149a384c5710adeb4fd8e795ffee7d6441e4edb71468c6cf1478e  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/bitcoin-edd70b52fcd7-powerpc64le-linux-gnu-debug.tar.gz
  bb9c3400a1dd88fa5fd26e8e22ba0f3a43263bdbb762233ed1670394d3d69ed1  guix-build-edd70b52fcd7/output/powerpc64le-linux-gnu/bitcoin-edd70b52fcd7-powerpc64le-linux-gnu.tar.gz
  926ef7a23ecdf02a6619f9dba0db814373c1a5105347e4c13b80a116910d1c8d  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/SHA256SUMS.part
  cdf7ce78f206378a44122865150784c20bf1bec6943b48e35a41633c0f1f05ed  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/bitcoin-edd70b52fcd7-riscv64-linux-gnu-debug.tar.gz
  026bbb6662f4074054457ce1678fc1d697bfbf87c80f1c3d5d560bcc18e3bea6  guix-build-edd70b52fcd7/output/riscv64-linux-gnu/bitcoin-edd70b52fcd7-riscv64-linux-gnu.tar.gz
  0190b93fc5d5202c6b252e51c34799fb153a284cc53b0e6f62d2521dc61866bd  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/SHA256SUMS.part
  69aac1a962aeeec01c30015f79d93c57d68a484c3905b8a526f90e7e7382bc1b  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.dmg
  ea37691f1df0389afedbb9eece45660dcb2ee867ffda1d26b244a471af2a6230  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx-unsigned.tar.gz
  f56ff4035e3bc70c2cbb04f8a7f5ef23096088189e84fa172cec97f59336cf2b  guix-build-edd70b52fcd7/output/x86_64-apple-darwin/bitcoin-edd70b52fcd7-osx64.tar.gz
  a1c1bf47083c6f19bcc68761ea56bec666cfe128f4ba878a5655ae12874fe038  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/SHA256SUMS.part
  cad26c66c764361b30c8204e7743dbb6c0e6dd1eb3af9418d77bd566e05e1470  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/bitcoin-edd70b52fcd7-x86_64-linux-gnu-debug.tar.gz
  ed2b459a06d5bc0f895402323fc5cae543a387d0621a55214feb37513210324e  guix-build-edd70b52fcd7/output/x86_64-linux-gnu/bitcoin-edd70b52fcd7-x86_64-linux-gnu.tar.gz
  ```

ACKs for top commit:
  hebasto:
    ACK edd70b52fc, a Guix `bitcoin-edd70b52fcd7-osx-unsigned.dmg` tested on Mac mini (M1, 2020) + macOS Monterey 12.1 (21C52).

Tree-SHA512: 00c55e139ce60c89900ef9365c380beec9474d8a0459bb584fd966d17715344fcf95b208b7222f665a5e3989aed51d3161641d3737aa6122a41b0c9f0d35906d
2022-01-28 14:37:23 +08:00
..
builders build: Fix regression introduced in PR23603 2021-12-24 13:17:07 +02:00
hosts build: use macOS 11 SDK (Xcode 12.2) 2022-01-26 17:28:16 +08:00
packages Merge bitcoin/bitcoin#24134: build: Fix zeromq package when cross-compiling 2022-01-27 10:44:48 +08:00
patches build: Update netbsd_kevent_void.patch 2022-01-25 14:36:05 +02:00
.gitignore depends: Support for S390X targets 2019-12-05 12:12:46 -05:00
config.guess depends: latest config.guess (2021-05-24) 2021-05-26 13:28:47 +08:00
config.site.in build: add systemtap's sys/sdt.h as depends 2022-01-04 10:13:24 +01:00
config.sub depends: latest config.sub (2021-04-30) 2021-05-26 13:30:18 +08:00
description.md doc: Fix whitespace errs in .md files, bitcoin.conf, Info.plist.in, and find_bdb48.m4 2019-09-17 03:21:22 -04:00
funcs.mk Merge bitcoin/bitcoin#22283: build: Replace $(AT) with .SILENT 2021-12-17 21:34:42 +01:00
gen_id depends: Fix id_string invocations 2021-04-08 20:17:20 -04:00
Makefile build: specify hosts for qrencode package 2022-01-18 15:30:31 +08:00
packages.md doc: Fix typos in packages.md 2021-11-28 18:13:52 +02:00
README.md doc: add arm macOS depends platform triplet 2022-01-26 17:32:46 +08:00

Usage

To build dependencies for the current arch+OS:

make

To build for another arch/OS:

make HOST=host-platform-triplet

For example:

make HOST=x86_64-w64-mingw32 -j4

Bitcoin Core's configure script by default will ignore the depends output. In order for it to pick up libraries, tools, and settings from the depends build, you must set the CONFIG_SITE environment variable to point to a config.site settings file. In the above example, a file named depends/x86_64-w64-mingw32/share/config.site will be created. To use it during compilation:

CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure

The default install prefix when using config.site is --prefix=depends/<host-platform-triplet>, so depends build outputs will be installed in that location.

Common host-platform-triplets for cross compilation are:

  • i686-pc-linux-gnu for Linux 32 bit
  • x86_64-pc-linux-gnu for x86 Linux
  • x86_64-w64-mingw32 for Win64
  • x86_64-apple-darwin for macOS
  • arm64-apple-darwin for ARM macOS
  • arm-linux-gnueabihf for Linux ARM 32 bit
  • aarch64-linux-gnu for Linux ARM 64 bit
  • powerpc64-linux-gnu for Linux POWER 64-bit (big endian)
  • powerpc64le-linux-gnu for Linux POWER 64-bit (little endian)
  • riscv32-linux-gnu for Linux RISC-V 32 bit
  • riscv64-linux-gnu for Linux RISC-V 64 bit
  • s390x-linux-gnu for Linux S390X
  • armv7a-linux-android for Android ARM 32 bit
  • aarch64-linux-android for Android ARM 64 bit
  • x86_64-linux-android for Android x86 64 bit

The paths are automatically configured and no other options are needed unless targeting Android.

Install the required dependencies: Ubuntu & Debian

For macOS cross compilation

sudo apt-get install curl bsdmainutils cmake libz-dev python3-setuptools libtinfo5 xorriso

Note: You must obtain the macOS SDK before proceeding with a cross-compile. Under the depends directory, create a subdirectory named SDKs. Then, place the extracted SDK under this new directory. For more information, see SDK Extraction.

For Win64 cross compilation

For linux (including i386, ARM) cross compilation

Common linux dependencies:

sudo apt-get install make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3 patch bison

For linux ARM cross compilation:

sudo apt-get install g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf

For linux AARCH64 cross compilation:

sudo apt-get install g++-aarch64-linux-gnu binutils-aarch64-linux-gnu

For linux POWER 64-bit cross compilation (there are no packages for 32-bit):

sudo apt-get install g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu g++-powerpc64le-linux-gnu binutils-powerpc64le-linux-gnu

For linux RISC-V 64-bit cross compilation (there are no packages for 32-bit):

sudo apt-get install g++-riscv64-linux-gnu binutils-riscv64-linux-gnu

For linux S390X cross compilation:

sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu

Dependency Options

The following can be set when running make: make FOO=bar

  • SOURCES_PATH: Downloaded sources will be placed here
  • BASE_CACHE: Built packages will be placed here
  • SDK_PATH: Path where SDKs can be found (used by macOS)
  • FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
  • NO_QT: Don't download/build/cache Qt and its dependencies
  • NO_QR: Don't download/build/cache packages needed for enabling qrencode
  • NO_ZMQ: Don't download/build/cache packages needed for enabling ZeroMQ
  • NO_WALLET: Don't download/build/cache libs needed to enable the wallet
  • NO_BDB: Don't download/build/cache BerkeleyDB
  • NO_SQLITE: Don't download/build/cache SQLite
  • NO_UPNP: Don't download/build/cache packages needed for enabling UPnP
  • NO_NATPMP: Don't download/build/cache packages needed for enabling NAT-PMP
  • ALLOW_HOST_PACKAGES: Packages that are missed in dependencies (due to NO_* option or build script logic) are searched for among the host system packages using pkg-config. It allows building with packages of other (newer) versions
  • MULTIPROCESS: Build libmultiprocess (experimental, requires CMake)
  • DEBUG: Disable some optimizations and enable more runtime checking
  • HOST_ID_SALT: Optional salt to use when generating host package ids
  • BUILD_ID_SALT: Optional salt to use when generating build package ids
  • FORCE_USE_SYSTEM_CLANG: (EXPERTS ONLY) When cross-compiling for macOS, use Clang found in the system's $PATH rather than the default prebuilt release of Clang from llvm.org. Clang 8 or later is required.

If some packages are not built, for example make NO_WALLET=1, the appropriate options will be passed to bitcoin's configure. In this case, --disable-wallet.

Additional targets

download: run 'make download' to fetch all sources without building them
download-osx: run 'make download-osx' to fetch all sources needed for macOS builds
download-win: run 'make download-win' to fetch all sources needed for win builds
download-linux: run 'make download-linux' to fetch all sources needed for linux builds

Other documentation