Building an application with the Web UI

The application build is manually triggered via the Web UI inside application overview. Triggering several application builds simultaneously inside a project is possible.

image build

If the package failed to build

  • Checking the logs can give you an indication about the reason of the failure.

If the build result was successful

  • If everything went well, it is time to go to the next step: installing the generated package on the board (Only if the new repo is already created)

Checking build logs

After the end of a build, the logs can be viewed inside each build information.

When a build is running, many tasks run simultaneously. You can check more information about tasks, here: Task Concept

image log

Build modes

There are 3 build modes that can be selected in an application settings.

Cross build

Cross-compilation is the default build mode used for architectures other than the native architecture of the builder. It installs dependencies into a sysroot for the target architecture in order to cross-compile the application.

A set of macros is provided to simplify the cross-compilation process and make it as transparent as possible. Please contact redpesk support if a configuration is missing, we can provide new ones upon request.

Emulated build

The emulated build is an option that can be enabled when creating or updating an application. This option enables the emulation of the application’s build for the selected architectures, using binfmt-misc with qemu interpreter for the build.

The emulated build uses the kernel featured from binfmt in order to run qemu only for foreign architectures.

For example, if the user wants to build his application for an aarch64 target, but doesn’t want to cross build his application, that’s where the emulated build can be enabled. This will allow the builder to call qemu for foreign architecture program.

Accel build

The accel build mode is designed to speed up emulation. It combines cross-compilation and emulation, and can be thought of as using a native sysroot inside a target rootfs. If a native tool is available, it will execute the native version; otherwise, the tool execution will be emulated.

Accel compilation uses a qemu static patched, for using it in local builder see accel.

Advanced cross-compilation

For cross-compilation, the default behaviour is to install all dependencies (BuildRequires) both in the native root and in the target sysroot.

However, some applications may only be available for a single architecture. For this purpose, two macros are available: %TargetBuildRequires and %NativeBuildRequires.

As their names suggest:

  • %TargetBuildRequires installs the dependency only in the target sysroot
  • %NativeBuildRequires installs the dependency only in the native root

A dependency can therefore be changed as follows:

- BuildRequires: foo
+ %TargetBuildRequires foo

Example with libfoo and bar

Let’s consider two applications that are intended to be built for the aarch64 architecture.

  • libfoo provides a shared library: libfoo.so and its headers are in libfoo-devel package
  • bar is an application that depends on libfoo

In the bar spec file, there is a build dependency on the development package:

BuildRequires: libfoo-devel

First case: cross build for both native and target architectures

If the native architecture is enabled, the libfoo package will be built for both native and target architectures. When building bar, the dependency will be installed automatically in both the native root and the target sysroot.

Second case: only the aarch64 architecture is enabled

In this case, there is no native libfoo RPM available. As a result, the build will fail when installing native packages, with an error similar to:

no libfoo-devel available

To fix this issue, replace the BuildRequires directive with:

- BuildRequires: libfoo-devel
+ %TargetBuildRequires libfoo-devel

Third case: switching the build mode

In this case, the spec file does not need to be modified. Instead, you can use a different build mode, such as an emulated build. This mode installs only target architecture packages, avoiding any error during dependency installation.