Skip to content
Mateusz Pietryga edited this page May 25, 2025 · 15 revisions

Configuring a cross-compilation build environment

Github Action

The native binaries for all architectures included in JSSC package are built publicly on Github using this Action and merged into git. This keeps them in sync with one another and with project version. The action is available to repository forks, so when contributing to the project you can always execute it on one of your branches, and after a few minutes it creates a branch (<selected_branch_name>_precompiled_natives) in your repository with all the binaries committed.

As a general contribution rule, the native binaries should not be included in PRs, and instead built using Github and merged by the project maintainers.

While keeping binaries in the source code may not be ideal, we feel it's a good compromise allowing project to be accessible to Java contributors without burdening them with the complexities of local C++ cross-compilation - and still having everything in one place.

Local environment configuration

In order to compile the C++ code locally you can follow these instructions:

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
  • Windows: arm64 (aarch64) using clang llvm-mingw wrapper
  • Linux: arm, arm64 (aarch64) and ppc64

Prerequisites

Starting point: A clean Debian/Ubuntu install with latest patches applied. (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

Windows ARM 64-bit

Note: Glibc 2.7+ required (Ubuntu 20.04+)

  1. Install dependencies
sudo apt-get install clang
  1. Cross-compile using mingwaarch64 toolchain (cmake will download automatically)
mvn -P mingwaarch64

Linux ARM 32-bit

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

Linux ARM 64-bit

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

Linux PPC 64-bit

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