# Unable to build ROS 2 workspace due to missing px4\_msgs dependency

**URL:** <https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565>\
**Category:** ROS 1 / ROS 2\
**Created:** [October 1, 2026, 3:26pm UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565 "2026-10-01T15:26:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaja7](https://discuss.px4.io/user_avatar/discuss.px4.io/jaja7/32/22110_2.png) [@jaja7](https://discuss.px4.io/u/jaja7)\
**Post date:** [October 1, 2026, 3:26pm UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/1 "2026-10-01T15:26:36Z")

</div>

I am working on building a PX4-ROS2-Gazebo-YOLOv8 software stack from source. During this process, I am attempting to build a ROS 2 workspace as follows:

```bash
mkdir -p ./ws_sensor_combined/src/
cd ./ws_sensor_combined/src/
git clone https://github.com/PX4/px4_msgs.git
git clone https://github.com/PX4/px4_ros_com.git
cd ..
source /opt/ros/jazzy/setup.bash
colcon build

```

The issue arises during `colcon build`. Namely, the ‘px4\_msgs’ package builds successfully but ‘px4\_ros\_com’ fails with this fatal error:

> Starting \>\>\> px4\_ros\_com — stderr: px4\_ros\_com /home/user/projects/ws\_sensor\_combined/src/px4\_ros\_com/src/examples/listeners/vehicle\_gps\_position\_listener.cpp:41:10: fatal error: px4\_msgs/msg/sensor\_gps.hpp: No such file or directory 41 | #include \<px4\_msgs/msg/sensor\_gps.hpp\> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. gmake[2]: \*\*\* [CMakeFiles/vehicle\_gps\_position\_listener.dir/build.make:76: CMakeFiles/vehicle\_gps\_position\_listener.dir/src/examples/listeners/vehicle\_gps\_position\_listener.cpp.o] Error 1 gmake[1]: \*\*\* [CMakeFiles/Makefile2:202: CMakeFiles/vehicle\_gps\_position\_listener.dir/all] Error 2 gmake[1]: \*\*\* Waiting for unfinished jobs… gmake: \*\*\* [Makefile:146: all] Error 2 — Failed \<\<\< px4\_ros\_com [6.98s, exited with code 2] Summary: 0 packages finished [7.05s] 1 package failed: px4\_ros\_com 1 package had stderr output: px4\_ros\_com

I’d appreciate any help tracking down why this error is happening despite ‘px4\_msgs’ building successfully. Thank you!

---

<div class="post-metadata">

**Author:** ![Benja](https://discuss.px4.io/user_avatar/discuss.px4.io/benja/32/11872_2.png) [@Benja](https://discuss.px4.io/u/Benja)\
**Post date:** [October 1, 2026, 4:25pm UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/2 "2026-10-01T16:25:51Z")

</div>

`px4_ros_com` repo have not been actively been maintained for PX4 (and `px4_msgs`) `main` branch. Do you have a particular need for it? I strongly suggest you to try the ROS 2 PX4 Interface library instead: [PX4 ROS 2 Interface Library | PX4 Guide (main)](https://docs.px4.io/main/en/ros2/px4_ros2_interface_lib)

Your build is failing because the msgs definitions in`px4_msgs` changed but the examples in `px4_ros_com` were not updated: `sensor_gps` got replaced with `sensor_gnss`.

---

<div class="post-metadata">

**Author:** ![jaja7](https://discuss.px4.io/user_avatar/discuss.px4.io/jaja7/32/22110_2.png) [@jaja7](https://discuss.px4.io/u/jaja7)\
**Post date:** [October 1, 2026, 5:50pm UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/3 "2026-10-01T17:50:37Z")

</div>

Would you happen to know what the last branch of the `px4_msgs`git project was that is compatible with `px4_ros_com`? I am following a set of instructions to setup a particular PX4-ROS2-Gazebo-YOLOv8 stack, as outlined [here](https://github.com/monemati/PX4-ROS2-Gazebo-YOLOv8#manual-installation), that relies on the build succeeding, but that fails to pin the respective branches.

---

<div class="post-metadata">

**Author:** ![Benja](https://discuss.px4.io/user_avatar/discuss.px4.io/benja/32/11872_2.png) [@Benja](https://discuss.px4.io/u/Benja)\
**Post date:** [October 1, 2026, 11:23pm UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/4 "2026-10-01T23:23:57Z")

</div>

the repo you linked does not target a specific PX4 release but seeing that the last commit was 8 months ago, I’d suggest you to try and use `v1.17.0`:  
use `v1.17.0` for PX4 and px4\_msgs and `main` for `px4_ros_com`.

Anyway, in the repo `px4_ros_com` is just used to remotely control the drone from ROS 2. If you want to use a better technique please consider replacing it with [GitHub - Auterion/px4-ros2-interface-lib: Library to interface with PX4 from a companion computer using ROS 2 · GitHub](https://github.com/Auterion/px4-ros2-interface-lib) . If you do that you can use `main` everywhere

---

<div class="post-metadata">

**Author:** ![yigitcan-ozturk](https://discuss.px4.io/user_avatar/discuss.px4.io/yigitcan-ozturk/32/22039_2.png) [@yigitcan-ozturk](https://discuss.px4.io/u/yigitcan-ozturk)\
**Post date:** [October 2, 2026, 8:51am UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/5 "2026-10-02T08:51:37Z")

</div>

Benja’s explanation points to the core issue: this is a **version-skew problem** , not a failed `px4_msgs` build.

If you need to reproduce that third-party stack exactly, I would pin all three moving parts explicitly:

- PX4 release/tag
- `px4_msgs` release/tag
- `px4_ros_com` commit

rather than relying on `main`.

For example, if `v1.17.0` is the compatibility point you choose, record the exact commit SHA of `px4_ros_com` that builds successfully with it as well. That makes the environment reproducible and prevents the same breakage later if `main` changes again.

I would also capture the failing and working combinations in a small compatibility table, e.g.:

| PX4 | px4\_msgs | px4\_ros\_com | Result |
| --- | --- | --- | --- |
| main | main | main | fails: `sensor_gps.hpp` missing |
| v1.17.0 | v1.17.0 | main/known SHA | test |

If the goal is long-term maintenance rather than reproducing the existing tutorial, migrating to `px4-ros2-interface-lib` is the cleaner path, as Benja suggested.

For tutorials that depend on multiple repos, pinning exact refs in the install instructions is important; otherwise a working setup can silently become unreproducible.

---

<div class="post-metadata">

**Author:** ![system](https://discuss.px4.io/uploads/default/original/3X/7/3/73ce918bdcd64854de904f0c8d9ab70ca9723f2a.png) [@system](https://discuss.px4.io/u/system)\
**Post date:** [October 9, 2026, 8:52am UTC](https://discuss.px4.io/t/unable-to-build-ros-2-workspace-due-to-missing-px4-msgs-dependency/49565/6 "2026-10-09T08:52:11Z")

</div>

Closed on October 9, 2026, 8:52am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
