# PX4 gazebo-classic build OpenCV missing requirments

**URL:** <https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732>\
**Category:** PX4 Autopilot\
**Created:** [September 15, 2024, 1:45pm UTC](https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732 "2024-09-15T13:45:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giorgio-P98](https://discuss.px4.io/user_avatar/discuss.px4.io/giorgio-p98/32/17322_2.png) [@Giorgio-P98](https://discuss.px4.io/u/Giorgio-P98)\
**Post date:** [September 15, 2024, 1:45pm UTC](https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732/1 "2024-09-15T13:45:17Z")

</div>

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:

```auto
find_package(OpenCV REQUIRED)

```

so i tried to install opencv running:

```auto
sudo apt install libopencv-dev

```

as suggested [here](https://opencv.org/get-started/) 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…

---

<div class="post-metadata">

**Author:** ![Giorgio-P98](https://discuss.px4.io/user_avatar/discuss.px4.io/giorgio-p98/32/17322_2.png) [@Giorgio-P98](https://discuss.px4.io/u/Giorgio-P98)\
**Post date:** [September 17, 2024, 6:33pm UTC](https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732/2 "2024-09-17T18:33:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ssapsu](https://discuss.px4.io/user_avatar/discuss.px4.io/ssapsu/32/17630_2.png) [@ssapsu](https://discuss.px4.io/u/ssapsu)\
**Post date:** [November 27, 2024, 8:05pm UTC](https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732/3 "2024-11-27T20:05:02Z")

</div>

Thank you @Giorgio-P98  
You saved my life

---

<div class="post-metadata">

**Author:** ![Giorgio-P98](https://discuss.px4.io/user_avatar/discuss.px4.io/giorgio-p98/32/17322_2.png) [@Giorgio-P98](https://discuss.px4.io/u/Giorgio-P98)\
**Post date:** [November 27, 2024, 8:48pm UTC](https://discuss.px4.io/t/px4-gazebo-classic-build-opencv-missing-requirments/40732/4 "2024-11-27T20:48:11Z")

</div>

glad to hear this @ssapsu.

I knew it would be useful to someone else
