Hailo-8L on Ubuntu 24.04 using Docker

My goal is to use the Raspberry Pi AI Kit (Hailo-8L) on a Raspberry Pi 5, running Ubuntu 24.04. This specific OS and version is required due to customers wanting the 10+years of support.

I’ve tried a couple of methods, including using the Raspberry Pi OS deb packages, but I keep on running into dependency problems. I’ve managed to get everything working on a Debian Bookworm Docker image, including the Raspberry Pi camera. See here.

My goal is however to use Ubuntu 24.04 as the base for the container. I started building this by compiling HailoRT and TAPPAS from source. However now I’m running into a problem where TAPPAS does not find the HailoRT shared library.

Is the process I’m following in the Dockerfile correct, or am I missing any steps?

Current error ourput:

./install.sh --skip-hailort --target-platform rpi
...
1338.0 [15/15] Linking target tools/gst-report-1.0
1338.0 ninja: Entering directory `build'
1338.0 [0/1] Installing files.
1338.2 Installing libs/gst/intercept/libgstintercept.so to /opt/hailo/tappas/lib/x86_64-linux-gnu
1338.2 Installing plugins/tracers/libgstinstruments.so to /opt/hailo/tappas/lib/x86_64-linux-gnu/gstreamer-1.0
1338.2 Installing tools/gst-top-1.0 to /opt/hailo/tappas/bin
1338.2 Installing tools/gst-report-1.0 to /opt/hailo/tappas/bin
1338.2 Installing /root/tappas/sources/gst-instruments/data/pull.svg to /opt/hailo/tappas/share/gst-instruments
1338.2 Installing /root/tappas/sources/gst-instruments/data/push.svg to /opt/hailo/tappas/share/gst-instruments
1338.2 ~/tappas/sources ~/tappas
1338.2 ~/tappas
1338.2 ldd: /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgsthailo.so: No such file or directory
1338.2 ls: cannot access '/usr/lib/libhailort.so': No such file or directory

Repo with Dockerfile: GitHub - jpm-canonical/hailo-docker-ubuntu: Hailo SDK in an Ubuntu docker image

Hey @jpm,

I’ve taken a look at the Dockerfile, and I noticed that there is no installation of the PCIe driver included.

Can you please provide more details on the error you encountered when trying to install the PCIe driver, HailoRT, PyHailoRT, and Tappas within an Ubuntu 24 environment? It would be helpful to know the specific steps you took and the error messages you received.

Best regards,

PCIe driver

This needs to be installed on the host. The deb of driver v4.18.0 does not install due to an error. The same error appears when compiling from source. A PR to fix the problem has been filed on Github: Add missing function definition by jpm-canonical · Pull Request #17 · hailo-ai/hailort-drivers · GitHub

After fixing this bug I can successfully build and install the driver on the host.

rpi5-host:~$ sudo dmesg | grep hailo
[    4.429982] hailo_pci: loading out-of-tree module taints kernel.
[    4.429993] hailo_pci: module verification failed: signature and/or required key missing - tainting kernel
[    4.430683] hailo: Init module. driver version 4.18.0
[    4.430786] hailo 0000:01:00.0: Probing on: 1e60:2864...
[    4.430790] hailo 0000:01:00.0: Probing: Allocate memory for device extension, 11632
[    4.430799] hailo 0000:01:00.0: enabling device (0000 -> 0002)
[    4.430805] hailo 0000:01:00.0: Probing: Device enabled
[    4.430822] hailo 0000:01:00.0: Probing: mapped bar 0 - 000000006d6c1c9a 16384
[    4.430828] hailo 0000:01:00.0: Probing: mapped bar 2 - 00000000f1fb8d64 4096
[    4.430833] hailo 0000:01:00.0: Probing: mapped bar 4 - 00000000c1d6a005 16384
[    4.430837] hailo 0000:01:00.0: Probing: Setting max_desc_page_size to 4096, (page_size=4096)
[    4.430846] hailo 0000:01:00.0: Probing: Enabled 64 bit dma
[    4.430848] hailo 0000:01:00.0: Probing: Using userspace allocated vdma buffers
[    4.430852] hailo 0000:01:00.0: Disabling ASPM L0s 
[    4.430856] hailo 0000:01:00.0: Successfully disabled ASPM L0s 
[    4.456118] UBSAN: array-index-out-of-bounds in /home/jpmeijers/hailort-drivers/linux/pcie/../../common/pcie_common.c:471:53
[    4.456151]  hailo_write_app_firmware+0x10c/0x118 [hailo_pci]
[    4.456167]  hailo_pcie_write_firmware+0x6c/0x168 [hailo_pci]
[    4.456176]  hailo_pcie_probe+0xbb4/0xf70 [hailo_pci]
[    4.456216]  hailo_pcie_module_init+0x98/0xff8 [hailo_pci]
[    4.628650] hailo 0000:01:00.0: Firmware was loaded successfully
[    4.707141] hailo 0000:01:00.0: Probing: Added board 1e60-2864, /dev/hailo0

HailoRT on the Host

Clone, build, install:

rpi5-host:~$ git clone https://github.com/hailo-ai/hailort.git
Cloning into 'hailort'...
rpi5-host:~$ cd hailort
rpi5-host:~/hailort$ git describe --exact-match --tags
v4.18.0
rpi5-host:~/hailort$ cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DHAILO_BUILD_EXAMPLES=1 && sudo cmake --build build --config release --target install

Testing:

rpi5-host:~/hailort$ hailortcli --version
HailoRT-CLI version 4.18.0

rpi5-host:~/hailort$ hailortcli fw-control identify
Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.18.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB241602838
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP

Forwarding hardware to Docker container

The PCIe hardware can be forwarded to the Docker container with volume mounts. This was done here: pi-ai-kit-ubuntu/docker-compose.yaml at 8f3f0dcf09ba52e8bedebec1136b8887ce6c7207 · canonical/pi-ai-kit-ubuntu · GitHub

Build the container and attach to shell

rpi5-host:~/docker-hailo$ docker compose build
rpi5-host:~/docker-hailo$ docker compose up -d
[+] Running 1/1
 ✔ Container docker-hailo-hailo-1  Started                                                                                                                                         0.6s 
rpi5-host:~/docker-hailo$ docker compose exec hailo /bin/bash
root@container:~#

HailoRT in the container

HailoRT is cloned, built and installed during building of the container. We start the container and test hailortcli:

root@container:~# hailortcli --version
HailoRT-CLI version 4.18.0

root@container:~# hailortcli fw-control identify
Executing on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.18.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB241602838
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP

Building TAPPAS inside container

root@container:~# cd tappas/
root@container:~/tappas/# ./install.sh --skip-hailort --target-platform rpi
...                                               
[15/15] Linking target tools/gst-report-1.0
ninja: Entering directory `build'
[0/1] Installing files.
Installing libs/gst/intercept/libgstintercept.so to /opt/hailo/tappas/lib/aarch64-linux-gnu
Installing plugins/tracers/libgstinstruments.so to /opt/hailo/tappas/lib/aarch64-linux-gnu/gstreamer-1.0
Installing tools/gst-top-1.0 to /opt/hailo/tappas/bin
Installing tools/gst-report-1.0 to /opt/hailo/tappas/bin
Installing /root/tappas/sources/gst-instruments/data/pull.svg to /opt/hailo/tappas/share/gst-instruments
Installing /root/tappas/sources/gst-instruments/data/push.svg to /opt/hailo/tappas/share/gst-instruments
~/tappas/sources ~/tappas
~/tappas
ldd: /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgsthailo.so: No such file or directory
ls: cannot access '/usr/lib/libhailort.so': No such file or directory

Full log here.

We can see building TAPPAS inside the container fails (while building libgsthailo.so), because it can’ find libhailort.so

But we can check and see libhailort.so is installed and available, but at a different path than where TAPPAS is looking.

root@container:~/tappas# whereis libhailort.so
libhailort.so: /usr/local/lib/libhailort.so

Manually copying libhailort to the other location:

root@container:~/tappas# cp /usr/local/lib/libhailort.so /usr/lib/               
root@container:~/tappas# ls /usr/lib/libhailort.so 
/usr/lib/libhailort.so

Trying to compile again.

root@container:~/tappas# ./install.sh --skip-hailort --target-platform rpi
...
-- Build files have been written to: /root/tappas/hailort/sources/hailort/libhailort/bindings/gstreamer/build
[  7%] Building CXX object CMakeFiles/gsthailo.dir/gst-hailo/gsthailoplugin.cpp.o
In file included from /root/tappas/hailort/sources/hailort/libhailort/bindings/gstreamer/gst-hailo/gsthailonet.hpp:34,
                 from /root/tappas/hailort/sources/hailort/libhailort/bindings/gstreamer/gst-hailo/gsthailoplugin.cpp:23:
/root/tappas/hailort/sources/hailort/libhailort/bindings/gstreamer/gst-hailo/gsthailo_dmabuf_allocator.hpp:24:10: fatal error: hailo/hailort_dma-heap.h: No such file or directory
   24 | #include "hailo/hailort_dma-heap.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/gsthailo.dir/build.make:76: CMakeFiles/gsthailo.dir/gst-hailo/gsthailoplugin.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/gsthailo.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Again a compile error. This time around I do not know how to fix it.