Make px4_sitl gazebo fails with opencv aruco.hpp

I am following the standard instructions to run PX4 sitl with gazebo:

$ make px4_sitl gazebo

…
– Found PythonInterp: /usr/bin/python3 (found suitable version β€œ3.8.10”, minimum required is β€œ3”)
– Found OpenCV: /usr/local (found version β€œ4.5.0”)
– Found TinyXML: /usr/lib/x86_64-linux-gnu/libtinyxml.so
…

…/Firmware/Tools/simulation/gazebo-classic/sitl_gazebo-classic/include/gazebo_aruco_plugin.h:41:10: fatal error: opencv2/aruco.hpp: No such file or directory
41 | #include <opencv2/aruco.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.

$ make px4_sitl jmavsim

Works fine and the JMAVsim runs correctly with QGroundControl.

I am correctly initialized, have tracked down numerous unmarked dependencies, re-installed, rebuilt, cleaned. to no avail.

Sadly I am left with building opencv + contrib (aruco is in the contrib portion)…

Any other help would be appreciated…

Are you checked out to a release version or just on main branch? I solved this problem by checking out to the latest release then running the environment setup script again

I built OpenCV 4.3 and that solved the problem. Ironically I set the OpenCV version just as you suggested - though it was documented.

I’ll remember your fix though - less work than rebuilding OpenCV…

Thanks for the help!