PX4 gazebo-classic build OpenCV missing requirments

Hi ,

I’m facing a problem with the px4_sitl gazebo-classic. In more than one post is highlighted the problem of not recognizing the “gazebo-classic” target. Installing the libgazebo-dev package solved this problem. Now if i run the make px4_sitl gazebo-classic the following error about opencv, pops out:

`CMake Error at CMakeLists.txt:64 (find_package):
By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “OpenCV”, but
CMake did not find one.

Could not find a package configuration file provided by “OpenCV” with any
of the following names:

OpenCVConfig.cmake
opencv-config.cmake

Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set
“OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”
provides a separate development package or SDK, be sure it has been
installed.
`

CmakeLists.txt file at line 64 is:

find_package(OpenCV REQUIRED)

so i tried to install opencv running:

sudo apt install libopencv-dev

as suggested here in the opencv site.

The actual problem is that to install this opencv package, libgazebo-dev needs to be removed because a conflict is detected.

Now i’m stuck in this never ending loop of installing and removing package, without finding a solution.

Ubuntu version: 22.04 LTS

It’s is worth to notice, that I worked without any problem with gazebeo-classic ROS-humble and PX4-Autopilot/v1.14 until yesterday.

Then i decided to update to the newest version of PX4 because i need some newly implemented features, and that’s where the problems started.
(I do not recognize differences in the CMakeLists.txt file of the two PX4 versions, and the line 64 about OpenCv is the same).

Clearly during the make process I broke the correct dependencies to run gazebo-classic on ubuntu 22.04, and now i do not know how to solve the problem.

Any help would be appreciated…

UPDATE: I solved the problem, by installing a different version for some OpenCv packages (it is always the 4.5.4, but is the 4.5.4+dfsg-9ubuntu4 not the 4.5.4+dfsg-9ubuntu4+22.04.sav1.1)

If someone encounter this problem, that’s how i solved it.