Building the SDK in a container

From AsteroidOS
Revision as of 11:01, 24 January 2024 by Jmlich (talk | contribs) (Add openembedded to related pages)


Summary

This page describes how to build the Software Development Kit (SDK) for AsteroidOS using software containers. If you want to build the SDK without using containers, see Building the SDK instead.

If you're not sure which you want, skip to With or without software containers?

If you're not sure why you would want an SDK, continue reading.

What is an SDK?

The Software Development Kit (SDK) for AsteroidOS is a set of tools and libraries for developing software to run on AsteroidOS. Since AsteroidOS is a Linux distribution, you can use just about any programming language to develop software, but most of the core applications use a combination of C++ and Qt, with CMake to build. To get things running quickly, it's recommended to download and install the prebuilt version as described in Installing the SDK. This page describes how to build the SDK from source. Be aware that this can take several hours, even on a fast computer.

Which SDK?

One thing to note is that while this describes "the SDK", there are actually two versions -- the main one is used to develop software that runs on ARM-based watches running AsteroidOS. The other one is the SDK for developing applications that run on the emulator, which uses qemux86. See the Emulator page for details on the qemux86 version. This page describes only the main ARM-based SDK but building the emulator version is almost the same. The only difference is that instead of this:

source ./prepare-build.sh dory
bitbake meta-toolchain-qt5

you would do this instead:

source ./prepare-build.sh qemux86
bitbake meta-toolchain-qt5

You can install both SDKs on the same machine -- they do not interfere.

With or without software containers?

There are two choices to build the SDK: build natively without software containers or build within a software container (such as docker or podman).

Building natively requires somewhat fewer resources (memory and disk space) than building with containers but requires software, such a compilers and other tools, to be installed on the host system. Since these software packages are different for each Linux distribution, this method requires more knowledge and patience to install required software that might not already be installed on your host computer.

The alternative, building with software containers, is somewhat more simpler in that the required software is only installed within the container and not on your host computer, but it requires much more time to compile everything. Still, this may be preferable for people who wish to keep the build environment isolated from the host computer.

The rest of this page describes how to build **with** containers. If you have decided to build natively instead, go to Building the SDK

Build with containers

Assuming you already prepared a docker or podman build environment as described in Building AsteroidOS, build the SDK like so:

sudo docker rm -f asteroidos-toolchain
sudo docker run -it \
  --name asteroidos-toolchain \
  -v /etc/passwd:/etc/passwd:ro \
  -u "$(id -u):$(id -g)" \
  -v "$HOME/.gitconfig:/$HOME/.gitconfig:ro" \
  -v "$(pwd):/asteroid" asteroidos-toolchain \
  bash -c "source ./prepare-build.sh dory && bitbake meta-toolchain-qt5"

or

podman run --rm -it \
  -v "$(pwd)":/asteroid:z \
  --userns keep-id asteroidos-toolchain \
  bash -c "source ./prepare-build.sh dory && bitbake meta-toolchain-qt5"

Install the SDK

Whether you have built with or without containers, if the process was successful, you should have an SDK installation script tmp-glibc/deploy/sdk/oecore-x86_64-armv7vehf-neon-toolchain-nodistro.0.sh (relative to the build directory) -- or a oecore-x86_64-core2-32-toolchain-nodistro.0.sh script if you are building the version of the SDK for the emulator. Follow these steps to install the SDK.

Related pages

Building the SDK

installing the SDK

Building AsteroidOS

Creating an Asteroid app

OpenEmbedded