By using Golang tools the Mender client can easily be cross-compiled to target a number of different architectures.

The Mender client must also be integrated with your board, cross-compiling it is often one step in the board integration process.

This example is targeting the armhf architecture but is applicable to other architectures with minor adjustments.


A Golang environment

Follow the instructions in the official Golang page to create a working Golang environment.

A cross-compiler toolchain

You will need a cross-compiler toolchain targeting your device. If you are using Ubuntu and targeting armhf, install it with:

sudo apt install gcc-arm-linux-gnueabihf

Compile the Mender client

First, fetch the Mender client source code:

go get

Change directory to where the Mender sources are:

cd $GOPATH/src/

Check out the version of the Mender client you want to compile; see git tag for available versions. For example, to use Mender 2.0.0 run the following command:

git checkout 2.0.0

Then cross-compile the mender binary with:

    CC=arm-linux-gnueabihf-gcc \
    GOOS=linux \
    GOARCH=arm make build

After compilation has finished, the Mender binary is located at:


The strip command for your toolchain can be used to reduce the size of the binary by removing symbols that are not needed on a production system. In our example, we can run arm-linux-gnueabihf-strip mender.