HomePhabricator

[CMAKE] Add cross compiling support for ARM32 and ARM64

Description

[CMAKE] Add cross compiling support for ARM32 and ARM64

Summary:
Add 2 new toolchain files for ARM cross compilation:

  • LinuxARM32 requires arm-linux-gnueabihf-gcc/g++
  • LinuxARM64 requires aarch64-linux-gnu-gcc/g++

The 32 bits binary has been tested on a RPI running raspbian.
The 64 bits binary has been tested on a RPI running Mate 18.04.

I did not test building bitcoin-qt. The build-unix.md instructions
for cross compiling suggest to not install Qt as part of the
dependencies, and this seems to be a rare use case for these targets.

Depends on D3017

Test Plan:

mkdir buildcmake && cd buildcmake
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/LinuxARM32.cmake \

-DBUILD_BITCOIN_QT=OFF -GNinja ..

ninja
file src/bitcoind

The output of file should indicate the binary is 32 bits and compiled
for ARM

rm -rf *
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/LinuxARM64.cmake \

-DBUILD_BITCOIN_QT=OFF -GNinja ..

ninja
file src/bitcoind

The output of file should indicate the binary is 64 bits and compiled
for ARM

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D3020

Details

Provenance
FabienAuthored on May 8 2019, 12:52
deadalnixPushed on May 25 2019, 15:00
Reviewer
Restricted Project
Differential Revision
D3020: [CMAKE] Add cross compiling support for ARM32 and ARM64
Parents
rSTAGINGa6d4a5e5d4a9: [CMAKE] Add cross build toolchain files for PC Linux platform
Branches
Unknown
Tags
Unknown