Skip to content

Building Headunit Desktop

Viktor Verebelyi edited this page Nov 7, 2023 · 31 revisions

Installing dependencies Debian based systems

The following commands are for Debian and its derivatives, some of the package names might be different on Ubuntu.

Install your basic make tools:

sudo apt-get install automake git alsa-utils

The minimum supported version of Qt is 5.11. You will need to install Qt and some of its modules first:

sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtdeclarative5-dev qtmultimedia5-dev \
libqt5multimedia5-plugins libqt5xmlpatterns5-dev libqt5bluetooth5 qtconnectivity5-dev libqt5charts5 libqt5serialport5 \
qml-module-qtquick2 qml-module-qtquick-layouts qml-module-qtquick-dialogs qml-module-qtquick-controls2 \
qml-module-qtquick-extras qml-module-qtquick-window2 qml-module-qtmultimedia qml-module-qt-labs-settings \
qml-module-qt-labs-folderlistmodel qml-module-qt-labs-platform qml-module-qtbluetooth qml-module-qtcharts \
qml-module-qtgraphicaleffects qml-module-qtquick-shapes

Each module has its own dependencies, you will need to install the following libraries and tools to get everything working:

sudo apt-get install build-essential protobuf-compiler libusb-1.0-0-dev libssl-dev openssl libglib2.0-dev \
libboost-dev libudev-dev libtag1-dev libprotobuf-dev libgstreamer1.0-dev gstreamer1.0-plugins-base-apps \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa libgstreamer-plugins-base1.0-dev \
gstreamer1.0-pulseaudio libfaad-dev libfftw3-dev librtlsdr-dev libairspy-dev libusb-1.0-0-dev mesa-common-dev \
libglu1-mesa-dev zlib1g-dev  portaudio19-dev libsndfile1-dev libsamplerate0-dev ofono ofono-dev \
pulseaudio bluez bluez-obexd pulseaudio-module-bluetooth qtconnectivity5-dev qtquickcontrols2-5-dev \
qml-module-qtbluetooth libkf5bluezqt-dev qml-module-org-kde-bluezqt qtbase5-private-dev libcanberra-dev \
libqt5charts5 libqt5charts5-dev qml-module-qtcharts libqt5serialport5-dev \
libgconf2-dev libpulse-dev libmp3lame-dev libsoapysdr-dev libmpg123-dev

Installing on Arch based systems

sudo pacman -S base-devel protobuf libusb openssl glib2 boost taglib gstreamer gst-plugins-good gst-plugins-ugly \
gst-plugins-bad gst-plugins-base gst-plugins-base-libs gst-libav gst-plugin-qmlgl faad2 fftw rtl-sdr airspy \ 
soapysdr mesa zlib portaudio libsndfile libsamplerate soapysdr bluez-qt pulseaudio-bluetooth libcanberra  \
qt5-base qt5-charts qt5-connectivity qt5-declarative qt5-graphicaleffects qt5-multimedia qt5-quickcontrols2 \
qt5-serialport qt5-tools ofono libqofono-git 

Compiling headunit-desktop

Once all the dependencies are installed you are ready to building the project. Before running any make command you will need to generate the protobuf files for Android Auto. Run the following command to do that:

protoc --proto_path=modules/android-auto/headunit/hu/ --cpp_out=modules/android-auto/headunit/hu/generated.x64/ modules/android-auto/headunit/hu/hu.proto modules/android-auto/headunit/hu/bt.proto

After this you need to create make files from the qmake project file. You can change the PREFIX variable to any location to your liking. It is highly recommended that you don't build the project in you source folder, so either create a build sub folder or build it outside the source path. In this case we will create a build dir inside the source path

mkdir build && cd build
qmake PREFIX=~/hud ../headunit-desktop.pro

Then run make. Make sure that you change number after -j to the number of your systems processor cores + 1

make -j5

And install the project in the directory you specified earlier. This step can be skipped as you can run HUD from the build dir, but it is recommended that you run it from a separate folder as the build directory contains a lot of temporary files. The build directory can be deleted after installing HUD.

make install

Running on X11 based systems

aad2 fftw rtl-sdr airspy \ soapysdr mesa zlib portaudio libsndfile libsamplerate soapysdr bluez-qt pulseaudio-bluetooth libcanberra
qt5-base qt5-charts qt5-connectivity qt5-declarative qt5-graphicaleffects qt5-multimedia qt5-quickcontrols2
qt5-serialport qt5-tools ofono ofono libqofono-git

Compiling headunit-desktop

Once all the dependencies are installed you are ready to building the project. Before running any make command you will need to generate the protobuf files for Android Auto. Run the following command to do that:

protoc --proto_path=modules/android-auto/headunit/hu/ --cpp_out=modules/android-auto/headunit/hu/generated.x64/ modules/android-auto/headunit/hu/hu.proto

After this you need to create make files from the qmake project file. You can change the PREFIX variable to any location to your liking. It is highly recommended that you don't build the project in you source folder, so either create a build sub folder or build it outside the source path. In this case we will create a build dir inside the source path

mkdir build && cd build
qmake PREFIX=~/hud ../headunit-desktop.pro

Then run make. Make sure that you change number after -j to the number of your systems processor cores + 1

make -j5

And install the project in the directory you specified earlier. This step can be skipped as you can run HUD from the build dir, but it is recommended that you run it from a separate folder as the build directory contains a lot of temporary files. The build directory can be deleted after installing HUD.

make install

Running on X11 based systems

~/hud/headunit-app

Running on a headless Raspbian install

~/hud/headunit-app

Running on a headless Raspbian install

The built app can be run on the lite version of Raspbian. There is no additional software needed for it. however you need to set the following environment variables before running:

QT_QPA_PLATFORM=eglfs QT_QPA_EGLFS_ALWAYS_SET_MODE=1 QT_QPA_EGLFS_KMS_ATOMIC=1 ~/hud/headunit-app