Px4 v1.8.0 build

I’m trying to use PX4 gazebo simulation v1.8.0 on linux 18.04. But I’m facing some issues.
Whenever I’m trying to build file using

make posix_sitl_default gazebo

I get this.

> -- PX4 VERSION: v1.8.0
> -- CONFIG: posix_sitl_default
> -- Build Type: RelWithDebInfo
> -- The CXX compiler identification is GNU 5.5.0
> -- The C compiler identification is GNU 5.5.0
> -- The ASM compiler identification is GNU
> -- Found assembler: /usr/bin/cc
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Check for working C compiler: /usr/bin/cc
> -- Check for working C compiler: /usr/bin/cc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Found PythonInterp: /usr/bin/python (found version "2.7.17") 
> -- Found PY_jinja2: /home/gps/.local/lib/python2.7/site-packages/jinja2  
> -- C compiler: cc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
> -- C++ compiler: c++ (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
> Submodule 'msg/tools/gencpp' (https://github.com/ros/gencpp.git) registered for path 'tools/gencpp'
> Submodule path 'tools/gencpp': checked out 'b41ee3060badd660662e21cd9d4f81971c87a420'
> Submodule 'msg/tools/genmsg' (https://github.com/ros/genmsg.git) registered for path 'tools/genmsg'
> Submodule path 'tools/genmsg': checked out 'a189fc78558e7276df59d2961cfe4f8b4de08a8b'
> Submodule 'src/lib/DriverFramework' (https://github.com/PX4/DriverFramework.git) registered for path 'src/lib/DriverFramework'
> Submodule path 'src/lib/DriverFramework': checked out '410e9fc4e78da91030e9d535a7f8e023a9ddd1f4'
> Submodule path 'src/lib/DriverFramework/dspal': checked out '9b46b4a57f230672ee0806a523963af70bc44f1c'
> Submodule path 'src/lib/DriverFramework/dspal/cmake_hexagon': checked out '07168bd5715818802b78f674816ec851307998a7'
> Submodule 'src/lib/ecl' (https://github.com/PX4/ecl.git) registered for path 'ecl'
> Submodule path 'ecl': checked out '1a1106878d6ab1cc48565bef9b25b07d626c5d0b'
> Submodule 'src/lib/matrix' (https://github.com/PX4/Matrix.git) registered for path 'matrix'
> Submodule path 'matrix': checked out 'b815fc97c4e686a93a8074f27d1830a031b0d38d'
> -- PX4 ECL: Very lightweight Estimation & Control Library v0.9.0-553-g1a11068
> Submodule 'src/drivers/gps/devices' (https://github.com/PX4/GpsDrivers.git) registered for path 'devices'
> Submodule path 'devices': checked out 'a5cf54a2e14e1c6f3ff443f7f13eba31782c0460'
> Submodule 'mavlink/include/mavlink/v2.0' (https://github.com/mavlink/c_library_v2.git) registered for path '../../../mavlink/include/mavlink/v2.0'
> Submodule path '../../../mavlink/include/mavlink/v2.0': checked out '033fa8e7a4a75a0c3f17cea57e3be8966e05f770'
> Submodule 'Tools/sitl_gazebo' (https://github.com/PX4/sitl_gazebo.git) registered for path '../../Tools/sitl_gazebo'
> Submodule path '../../Tools/sitl_gazebo': checked out 'b5a92095bfb1b6a218a80f58ad9fe09c89ef4598'
> Submodule path '../../Tools/sitl_gazebo/external/OpticalFlow': checked out '549cc7cacb01bb71b2386586305c889d3651cfcc'
> Submodule path '../../Tools/sitl_gazebo/external/OpticalFlow/external/klt_feature_tracker': checked out 'a0d242294ef638d8fa422ab43f0d476ba37a15a6'
> Submodule 'Tools/jMAVSim' (https://github.com/PX4/jMAVSim.git) registered for path '../../Tools/jMAVSim'
> Submodule path '../../Tools/jMAVSim': checked out 'e0e8b6ca473a6eecc3ee2984ea414e321f6808c6'
> Submodule path '../../Tools/jMAVSim/jMAVlib': checked out 'afa488d166813038c28572907eacf6eaa54f3c7c'
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/gps/src/Firmware/build/posix_sitl_default
> ninja: Entering directory `/home/gps/src/Firmware/build/posix_sitl_default'
> [632/636] Performing configure step for 'sitl_gazebo'
> -- install-prefix: /usr/local
> -- The C compiler identification is GNU 5.5.0
> -- The CXX compiler identification is GNU 5.5.0
> -- Check for working C compiler: /usr/bin/cc
> -- Check for working C compiler: /usr/bin/cc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Looking for pthread.h
> -- Looking for pthread.h - found
> -- Looking for pthread_create
> -- Looking for pthread_create - not found
> -- Looking for pthread_create in pthreads
> -- Looking for pthread_create in pthreads - not found
> -- Looking for pthread_create in pthread
> -- Looking for pthread_create in pthread - found
> -- Found Threads: TRUE  
> -- Boost version: 1.65.1
> -- Found the following Boost libraries:
> --   system
> --   thread
> --   timer
> --   chrono
> --   date_time
> --   atomic
> -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
> -- Checking for module 'bullet>=2.82'
> --   Found bullet, version 2.87
> -- Found Simbody: /usr/include/simbody  
> -- Boost version: 1.65.1
> -- Found the following Boost libraries:
> --   thread
> --   system
> --   filesystem
> --   program_options
> --   regex
> --   iostreams
> --   date_time
> --   chrono
> --   atomic
> -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0") 
> -- Boost version: 1.65.1
> -- Looking for OGRE...
> -- OGRE_PREFIX_WATCH changed.
> -- Checking for module 'OGRE'
> --   Found OGRE, version 1.9.0
> -- Found Ogre Ghadamon (1.9.0)
> -- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so
> -- Looking for OGRE_Paging...
> -- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so
> -- Looking for OGRE_Terrain...
> -- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so
> -- Looking for OGRE_Property...
> -- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so
> -- Looking for OGRE_RTShaderSystem...
> -- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so
> -- Looking for OGRE_Volume...
> -- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so
> -- Looking for OGRE_Overlay...
> -- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so
> -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread;-lpthread (found suitable version "3.0.0", minimum required is "2.3.0") 
> -- Config-file not installed for ZeroMQ -- checking for pkg-config
> -- Checking for module 'libzmq >= 4'
> --   Found libzmq , version 4.2.5
> -- Found ZeroMQ: TRUE (Required is at least version "4") 
> -- Checking for module 'uuid'
> --   Found uuid, version 2.31.1
> -- Found UUID: TRUE  
> -- Checking for module 'tinyxml2'
> --   Found tinyxml2, version 6.0.0
> -- Looking for dlfcn.h - found
> -- Looking for libdl - found
> -- Found DL: TRUE  
> -- FreeImage.pc not found, we will search for FreeImage_INCLUDE_DIRS and FreeImage_LIBRARIES
> -- Checking for module 'gts'
> --   Found gts, version 0.7.6
> -- Found GTS: TRUE  
> -- Checking for module 'libswscale'
> --   Found libswscale, version 4.8.100
> -- Found SWSCALE: TRUE  
> -- Checking for module 'libavdevice >= 56.4.100'
> --   Found libavdevice , version 57.10.100
> -- Found AVDEVICE: TRUE (Required is at least version "56.4.100") 
> -- Checking for module 'libavformat'
> --   Found libavformat, version 57.83.100
> -- Found AVFORMAT: TRUE  
> -- Checking for module 'libavcodec'
> --   Found libavcodec, version 57.107.100
> -- Found AVCODEC: TRUE  
> -- Checking for module 'libavutil'
> --   Found libavutil, version 55.78.100
> -- Found AVUTIL: TRUE  
> -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.58.0") 
> -- Checking for module 'jsoncpp'
> --   Found jsoncpp, version 1.7.4
> -- Found JSONCPP: TRUE  
> -- Checking for module 'yaml-0.1'
> --   Found yaml-0.1, version 0.1.7
> -- Found YAML: TRUE  
> -- Checking for module 'libzip'
> --   Found libzip, version 1.1.2
> -- Found ZIP: TRUE  
> -- Found PythonInterp: /usr/bin/python (found version "2.7.17") 
> -- Found OpenCV: /usr/local (found version "4.2.0") 
> -- Found TinyXML: /usr/lib/x86_64-linux-gnu/libtinyxml.so  
> -- Checking for module 'OGRE'
> --   Found OGRE, version 1.9.0
> -- Building klt_feature_tracker without catkin
> -- Building OpticalFlow with OpenCV
> -- Found MAVLink: /home/gps/src/Firmware/mavlink/include (found version "2.0") 
> -- catkin DISABLED
> -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread;-lpthread;-lpthread (found version "3.0.0") 
> -- Checking for module 'protobuf'
> --   Found protobuf, version 3.0.0
> Gazebo version: 9.19
> -- Performing Test COMPILER_SUPPORTS_CXX17
> -- Performing Test COMPILER_SUPPORTS_CXX17 - Success
> -- Performing Test COMPILER_SUPPORTS_CXX14
> -- Performing Test COMPILER_SUPPORTS_CXX14 - Success
> -- Performing Test COMPILER_SUPPORTS_CXX11
> -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
> -- Performing Test COMPILER_SUPPORTS_CXX0X
> -- Performing Test COMPILER_SUPPORTS_CXX0X - Success
> -- Using C++17 compiler
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/gps/src/Firmware/build/posix_sitl_default/build_gazebo
> [633/636] Performing build step for 'sitl_gazebo'
> FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build 
> cd /home/gps/src/Firmware/build/posix_sitl_default/build_gazebo && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /home/gps/src/Firmware/build/posix_sitl_default/external/Stamp/sitl_gazebo/sitl_gazebo-build
> [1/73] Running C++ protocol buffer compiler on msgs/MotorSpeed.proto
> [2/73] Running C++ protocol buffer compiler on msgs/Range.proto
> [3/73] Running C++ protocol buffer compiler on msgs/Groundtruth.proto
> [4/73] Running C++ protocol buffer compiler on msgs/SITLGps.proto
> [5/73] Running C++ protocol buffer compiler on msgs/OpticalFlow.proto
> [6/73] Running C++ protocol buffer compiler on msgs/CommandMotorSpeed.proto
> [7/73] Running C++ protocol buffer compiler on msgs/Odometry.proto
> [8/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/c920/c920.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf
> [9/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf
> [10/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf
> [11/73] Running C++ protocol buffer compiler on msgs/Int32.proto
> [12/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf
> [13/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf
> [14/73] Running C++ protocol buffer compiler on msgs/Imu.proto
> [15/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf
> [16/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf
> [17/73] Running C++ protocol buffer compiler on msgs/IRLock.proto
> [18/73] Running C++ protocol buffer compiler on msgs/Float.proto
> [19/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf
> /home/gps/src/Firmware/Tools/sitl_gazebo/models/r200/r200.sdf.jinja -> /home/gps/src/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf
> [20/73] Building CXX object CMakeFiles/gazebo_mavlink_interface.dir/src/geo_mag_declination.cpp.o
> [21/73] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/optical_flow.cpp.o
> [22/73] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/flow_px4.cpp.o
> [23/73] Building CXX object OpticalFlow/CMakeFiles/OpticalFlow.dir/src/px4flow.cpp.o
> [24/73] Building CXX object CMakeFiles/mav_msgs.dir/MotorSpeed.pb.cc.o
> [25/73] Building CXX object CMakeFiles/std_msgs.dir/Int32.pb.cc.o
> [26/73] Building CXX object CMakeFiles/mav_msgs.dir/CommandMotorSpeed.pb.cc.o
> [27/73] Building CXX object CMakeFiles/sensor_msgs.dir/Float.pb.cc.o
> [28/73] Building CXX object CMakeFiles/nav_msgs.dir/Odometry.pb.cc.o
> [29/73] Linking CXX shared library libmav_msgs.so
> [30/73] Generating /home/gps/src/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
> 
> [31/73] Linking CXX shared library libnav_msgs.so
> [32/73] Building CXX object CMakeFiles/sensor_msgs.dir/IRLock.pb.cc.o
> [33/73] Building CXX object CMakeFiles/sensor_msgs.dir/Groundtruth.pb.cc.o
> [34/73] Building CXX object CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o
> FAILED: CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o 
> /usr/bin/c++  -DLIBBULLET_VERSION=2.87 -DLIBBULLET_VERSION_GT_282 -Dgazebo_geotagged_images_plugin_EXPORTS -isystem /usr/include/gazebo-9 -isystem /usr/include/bullet -isystem /usr/include/simbody -isystem /usr/include/sdformat-6.3 -isystem /usr/include/ignition/math4 -isystem /usr/include/OGRE -isystem /usr/include/OGRE/Terrain -isystem /usr/include/OGRE/Paging -isystem /usr/include/ignition/transport4 -isystem /usr/include/ignition/msgs1 -isystem /usr/include/ignition/common1 -isystem /usr/include/ignition/fuel_tools1 -I/home/gps/src/Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-9/gazebo/msgs -I/home/gps/src/Firmware/mavlink/include -isystem /usr/local/include/opencv4 -I/home/gps/src/Firmware/Tools/sitl_gazebo/external/OpticalFlow/include -isystem /usr/include/uuid -isystem /usr/include/x86_64-linux-gnu -std=c++17 -std=c++11 -Wno-deprecated-declarations -fPIC   -I/usr/include/uuid -I/usr/include/x86_64-linux-gnu -std=gnu++14 -MD -MT CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o -MF CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o.d -o CMakeFiles/gazebo_geotagged_images_plugin.dir/src/gazebo_geotagged_images_plugin.cpp.o -c /home/gps/src/Firmware/Tools/sitl_gazebo/src/gazebo_geotagged_images_plugin.cpp
> /home/gps/src/Firmware/Tools/sitl_gazebo/src/gazebo_geotagged_images_plugin.cpp:25:16: fatal error: cv.h: No such file or directory
> compilation terminated.
> [35/73] Linking CXX shared library libstd_msgs.so
> [36/73] Building CXX object CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o
> [37/73] Building CXX object CMakeFiles/gazebo_imu_plugin.dir/src/gazebo_imu_plugin.cpp.o
> [38/73] Building CXX object CMakeFiles/gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o
> [39/73] Building CXX object CMakeFiles/gazebo_vision_plugin.dir/src/gazebo_vision_plugin.cpp.o
> [40/73] Building CXX object CMakeFiles/gazebo_motor_model.dir/src/gazebo_motor_model.cpp.o
> [41/73] Building CXX object CMakeFiles/gazebo_multirotor_base_plugin.dir/src/gazebo_multirotor_base_plugin.cpp.o
> [42/73] Building CXX object CMakeFiles/gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o
> [43/73] Building CXX object CMakeFiles/gazebo_mavlink_interface.dir/src/gazebo_mavlink_interface.cpp.o
> ninja: build stopped: subcommand failed.
> ninja: build stopped: subcommand failed.
> Makefile:148: recipe for target 'posix_sitl_default' failed
> make: *** [posix_sitl_default] Error 1

It seem gazebo sitl is having an issue. How should I fix this?

Not familiar with the whole build environment, but “cv.h” seems to be part of OpenCV, you may want to check your dependencies/prerequisites

May be cleaning make clean and then rebuilding will solve the problem.

opencv is 3.2.0. But it seems opencv 3.2.0 is compatible.

That doesn’t work and yield the same result. There seems to be issue in sitl gazebo.