Skip to content

Cross Compilation

Tres Finocchiaro edited this page Jul 23, 2021 · 1 revision

Configuring a cross-compilation build environment

This builds the library based on the G++ compiler and its supplemental packages.
This will allow you to build native binaries for

  • Windows: x86, x86_64 using mingw-w64
  • Linux: arm, arm64 (aarch64) and ppc64 native

Prerequisites

Starting point: A clean Ubuntu install with latest patches applied, one of:

  • Ubunutu 14.04 Trusty Tahr
  • Ubunutu 16.04 Xenial Xerus
  • Ubunutu 20.04 Focal Fossa

(other platforms will work, but the package names and commands may vary)

Windows 32-bit

  1. Install dependencies
sudo apt-get install mingw-w64 binutils-mingw-w64-i686
  1. Cross-compile using mingw32 toolchain
mvn -P mingw32

Windows 64-bit

  1. Install dependencies
sudo apt-get install mingw-w64
  1. Cross-compile using mingw32 toolchain
mvn -P mingw64

ARM 32-bit

  1. Install dependencies
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
  1. Cross-compile using armhf toolchain
mvn -P armhf

ARM 64-bit

  1. Install dependencies
sudo apt-get install g++-aarch64-linux-gnu
  1. Cross-compile using aarch64 toolchain
mvn -P aarch64

PPC64

  1. Install dependencies
sudo apt-get install g++-powerpc64le-linux-gnu
  1. Cross-compile using ppc64 toolchain
mvn -P ppc64

g++-powerpc64le-linux-gnu

Clone this wiki locally