Building the SDK: Difference between revisions

From AsteroidOS
m (prettify Related pages)
(→‎Which SDK?: update to scarthgap toolchain installer names)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Developers]]
[[Category:Developers]]
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. There are two choices to build the SDK: build natively without software containers or build within a software container (such as docker or podman).
 
==Summary==
This page describes how to build the Software Development Kit (SDK) for AsteroidOS '''without''' using ''software containers''.  If you want to build the SDK using containers, see [[Building the SDK in a container]] instead.   
 
If you're not sure which you want, skip to [[Building_the_SDK#With_or_without_software_containers?|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 sturgeon
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.
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.
Line 8: Line 31:
== Building the Cross Compilation Toolchain ==
== Building the Cross Compilation Toolchain ==


If you’ve already got an OpenEmbedded build directory via the [[Building AsteroidOS]] page, cd to that directory. Else, create one with:
If you’ve already got an OpenEmbedded build directory via the [[Building AsteroidOS]] page, <code>cd</code> to that directory. Else, create one with:
 
=== Build without containers ===


<pre>
<pre>
Line 24: Line 45:
</pre>
</pre>


=== Build with containers===
Assuming you already prepared a docker or podman build environment as described in [[Building AsteroidOS]], build the SDK like so:
<pre>
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"
</pre>
or
<pre>
podman run --rm -it \
  -v "$(pwd)":/asteroid:z \
  --userns keep-id asteroidos-toolchain \
  bash -c "source ./prepare-build.sh dory && bitbake meta-toolchain-qt5"
</pre>


==Install the SDK==
==Install the SDK==
Whether you have built with or without containers, if the process was successful, you should have an SDK installation script <code>tmp-glibc/deploy/sdk/oecore-x86_64-armv7vehf-neon-toolchain-nodistro.0.sh</code> (relative to the <code>build</code>> directory).  Follow [[installing the SDK#Installing the SDK|these steps]] to install the SDK.
Whether you have built with or without containers, if the process was successful, you should have an SDK installation script <code>tmp-glibc/deploy/sdk/oecore-meta-toolchain-qt5-x86_64-armv7vehf-neon-sturgeon-toolchain-nodistro.0.sh</code> (relative to the <code>build</code> directory) -- or a <code>oecore-meta-toolchain-qt5-x86_64-core2-32-qemux86-toolchain-nodistro.0.sh</code> script if you are building the version of the SDK for the emulator.  Follow [[installing the SDK#Installing the SDK|these steps]] to install the SDK.


==Related pages==
==Related pages==
[[Building the SDK in a container]]


[[installing the SDK]]
[[installing the SDK]]

Latest revision as of 22:44, 21 August 2024


Summary

This page describes how to build the Software Development Kit (SDK) for AsteroidOS without using software containers. If you want to build the SDK using containers, see Building the SDK in a container 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 sturgeon
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.

Building the Cross Compilation Toolchain

If you’ve already got an OpenEmbedded build directory via the Building AsteroidOS page, cd to that directory. Else, create one with:

git clone https://github.com/AsteroidOS/asteroid
cd asteroid/

Then, build the cross compilation toolchain with:

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-meta-toolchain-qt5-x86_64-armv7vehf-neon-sturgeon-toolchain-nodistro.0.sh (relative to the build directory) -- or a oecore-meta-toolchain-qt5-x86_64-core2-32-qemux86-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 in a container

installing the SDK

Building AsteroidOS

Creating an Asteroid app