Build from Source

Compile OctoMY™ from source code

Build from Source

Build OctoMY™ from source code using Qt and the Qbs build system.

Pro Tip

Use Qt's online installer for the cleanest setup - it includes Qbs and all optional Qt modules. Package manager versions often lag behind and may be missing modules like Bluetooth or Positioning.


Prerequisites

Required software

Software Version Purpose
Qt 6.5+ UI framework
Qbs 2.0+ Build system
Git Any Source control
GCC/Clang C++20 support Compiler

Linux dependencies

Debian/Ubuntu:

# Install Qt 6 and tools
sudo apt install qt6-base-dev qt6-multimedia-dev qt6-serialport-dev
sudo apt install qt6-positioning-dev qt6-svg-dev qt6-sensors-dev
sudo apt install libqt6opengl6-dev qt6-tools-dev

# Install build tools
sudo apt install build-essential git cmake

# Install Qbs (if not included with Qt)
sudo apt install qbs

Fedora:

# Install Qt 6
sudo dnf install qt6-qtbase-devel qt6-qtmultimedia-devel
sudo dnf install qt6-qtserialport-devel qt6-qtpositioning-devel
sudo dnf install qt6-qtsvg-devel qt6-qtsensors-devel

# Build tools
sudo dnf install gcc-c++ git cmake qbs

Arch Linux:

sudo pacman -S qt6-base qt6-multimedia qt6-serialport qt6-positioning
sudo pacman -S qt6-svg qt6-sensors qt6-tools
sudo pacman -S base-devel git cmake qbs

Qt installation via Qt Installer

For the latest Qt with all modules:

  1. Download Qt Online Installer
  2. Run and select:
    • Qt 6.x for Desktop
    • Qt Creator
    • Qt Debug Information Files (optional)

Step 1: Clone the repository

# Clone with submodules
git clone --recursive https://github.com/mrdeveloperdude/OctoMY.git
cd OctoMY

# If already cloned without --recursive
git submodule update --init --recursive

Step 2: Configure Qbs

First-time setup

# Configure Qbs to use your Qt installation
qbs setup-toolchains --detect

# Setup Qt profile
qbs setup-qt /path/to/qmake qt6

# List available profiles
qbs config --list profiles

Profile configuration

For Qt installed via package manager:

qbs setup-qt /usr/bin/qmake6 qt6

For Qt installed via Qt Installer:

qbs setup-qt ~/Qt/6.8.3/gcc_64/bin/qmake qt6

Verify configuration

qbs config profiles.qt6.baseProfile
# Should show: gcc or clang

Step 3: Build the project

Full build

# Resolve dependencies
qbs resolve -f project.qbs profile:qt6

# Build all targets
qbs build -f project.qbs profile:qt6

Debug build

qbs build -f project.qbs profile:qt6 config:debug

Release build

qbs build -f project.qbs profile:qt6 config:release

Parallel build

# Use all CPU cores
qbs build -f project.qbs profile:qt6 -j$(nproc)

Step 4: Build output

Build artifacts are placed in:

default/
├── install-root/
│   └── usr/local/bin/
│       ├── agent       # Agent executable
│       ├── remote      # Remote executable
│       ├── hub         # Hub executable
│       └── zoo         # Zoo executable
└── <product-name>/
    └── <config>/
        └── <executable>

Run built applications

# Run Agent
./default/install-root/usr/local/bin/agent --personality Test

# Run Remote
./default/install-root/usr/local/bin/remote --personality Test

# Run with debug output
./default/install-root/usr/local/bin/agent --debug

Build specific targets

List available products

qbs list-products -f project.qbs

Build single target

# Build only the Agent
qbs build -f project.qbs profile:qt6 -p agent

# Build only tests
qbs build -f project.qbs profile:qt6 -p "test*"

Cross-Compilation

Android build

# Setup Android NDK profile
qbs setup-android --ndk-dir ~/Android/Sdk/ndk/25.1.8937393 android

# Build for Android
qbs build -f project.qbs profile:android

Raspberry Pi (ARM)

# Setup ARM toolchain
qbs setup-toolchains --detect

# Build for ARM
qbs build -f project.qbs profile:arm-linux

Build options

CMake variables (via Qbs modules)

Option Default Description
project.withBluetooth true Enable Bluetooth support
project.withGPS true Enable GPS support
project.withVideo true Enable video streaming
project.withArduino true Enable ArduMY support

Example

qbs build -f project.qbs \
    profile:qt6 \
    project.withBluetooth:false

Clean build

# Clean build artifacts
qbs clean -f project.qbs

# Full clean (removes build directory)
rm -rf default/

# Clean and rebuild
qbs clean && qbs build -f project.qbs profile:qt6

IDE integration

Qt Creator

  1. Open project.qbs in Qt Creator
  2. Configure kit (Qt 6 + Qbs)
  3. Build and run from IDE

Visual Studio Code

Install extensions:

  • C/C++ (Microsoft)
  • Qbs Tools

Configure settings.json:

{
    "qbs.qbsPath": "/usr/bin/qbs",
    "qbs.settingsDirectory": "~/.config/QtProject/qbs"
}

Troubleshooting

"Qt not found"

# Verify Qt installation
qmake6 --version

# Check Qbs profile
qbs config profiles.qt6

# Reconfigure
qbs setup-qt $(which qmake6) qt6

"Module not found"

# Install missing Qt module
sudo apt install qt6-<module>-dev

# Example for Bluetooth
sudo apt install qt6-connectivity-dev

Compiler errors

# Check compiler version (need C++20)
g++ --version

# Should be GCC 10+ or Clang 11+

"qbs: command not found"

# Install Qbs
sudo apt install qbs

# Or use Qt's Qbs
export PATH=~/Qt/Tools/QtCreator/bin:$PATH

Build fails with OpenGL

# Install OpenGL development files
sudo apt install libgl1-mesa-dev libglu1-mesa-dev

Dependencies reference

Core Qt modules

Module Package Purpose
Qt Core qt6-base-dev Core functionality
Qt GUI qt6-base-dev Graphics
Qt Widgets qt6-base-dev UI components
Qt Network qt6-base-dev Networking

Optional Qt modules

Module Package Feature
Qt Bluetooth qt6-connectivity-dev Bluetooth
Qt Multimedia qt6-multimedia-dev Audio/Video
Qt SerialPort qt6-serialport-dev Arduino
Qt Positioning qt6-positioning-dev GPS
Qt Sensors qt6-sensors-dev IMU

Third-party libraries

OctoMY™ includes these as submodules:

  • mbedTLS (cryptography)
  • QMapControl (maps)
  • QHexEdit (binary editor)
  • Hoedown (Markdown)

In this section
Topics
howto development building compilation Qbs Qt
See also