I am trying to compile the gazebo example provided by PX4, according to PX4's instructions. I am working on Ubuntu-18.04.
When running the command: make px4_sitl gazebo
, following error occurs:
...
In file included from Range.pb.h:27:0,
from Range.pb.cc:5:
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^~~~~
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^~~~~
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:14:2: error: #error your headers.
#error your headers.
^~~~~
...
Piecing the error message back together gives: This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer headers. Please update your headers.
I have two different protoc
binaries on my machine:
/usr/bin/protoc
(3.0.0), the minimum version required~/catkin_ws/devel/bin/protoc
(2.6.0), which is too old and used by defaultHow can I make sure the first version is used? I tried this: export PATH=/usr/bin:$PATH
to make sure the right compiler is found first but I would also probably need to indicate to use the right headers, hence the ones in /usr/include/google/protobuf
instead of ~/catkin_ws/devel/include/google/protobuf
. However, I am not sure about how to proceed.
Ok, so simply making the bad path invalid (modified it) forced make
to use the right compiler version since it could not find the wrong version anymore.
Weird to see that putting the path of the correct version first in the PATH
variable did not seem to have any effect.