Problem with Hailo-Application-Code-Examples cpp pose estimation example after upgrading to Hailo-RT v4.18

After upgrading to a newer version of Hailo-RT, you are rebuilding a cpp example from Hailo-Application-Code-Examples cpp example, but you are getting the error:

[HailoRT] [error] Failed to query driver info, errno 25
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_DRIVER_FAIL(36)
Failed create vdevice, status = 36

This is very likely due to a mismatch between the firmware loaded on the Hailo-8 card and the version of the library linked with the cpp code.

You can find the version of the firmware loaded on the Hailo-8 by running:

hailortcli fw-control identify

the output should be similar to:

Executing on device: 0000:3c: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 Test blablab
Device Architecture: HAILO8
Serial Number: HLLWM20213001232
Part Number: HM218B1C2FA
Product Name: HAILO-8 AI ACCELERATOR M.2 M KEY MODULE

To find the Hailo-RT library linked with the cpp executable, use the command ‘ldd’, for example:

ldd ./build/x86_64/vstream_yolov8pose_example_cpp | grep hailo
libhailort.so.4.17.0 => /lib/libhailort.so.4.17.0 (0x00007f787bef4000)

You can see here the version of the Hailo-RT linked with the CPP (v4.17) mismatches the driver (v4.18).

How can this happen ? The cpp build process uses Cmake and a quick glance at the CMakeLists.txt shows this line:

find_package(HailoRT REQUIRED)

and sometimes find_package() doesn’t always find the latest version if the location of the library differs from one version to the other.
The solution is to modify this line by passing the version required:

find_package(HailoRT 4.18.0 REQUIRED)

You can also force the build process to output the search paths that find_package() is looking for by passing an erroneous version number such as:

find_package(HailoRT 0.0.0 REQUIRED)

-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:19 (find_package):
  Could not find a configuration file for package "HailoRT" that is
  compatible with requested version "0.0.0".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/HailoRT/HailoRTConfig.cmake, version: 4.17.0
    /usr/lib/cmake/HailoRT/HailoRTConfig.cmake, version: 4.18.0
    /lib/cmake/HailoRT/HailoRTConfig.cmake, version: 4.18.0

From this log, you can deduce that removing the file /usr/local/lib/cmake/HailoRT/HailoRTConfig.cmake also fixes the issue.