MAVLink headers generated from PX4-compatible definitions incompatible with QGC

I’m currently working with a custom PX4 stack and QGroundControl (QGC) setup and have run into a compatibility issue with the generated MAVLink headers. Here’s the setup:

  • PX4 is based on branch from v1.15.0-rc2.
  • QGC is branched from Stable4.4.
  • I’m using two separate repositories:
    • mavlink/mavlink: branched from the same MAVLink version used by PX4.
    • mavlink/c_library_v2: branched from the commit used in QGC.

The issue arises when I generate headers using the PX4-compatible mavlink definitions (via generator script), and then attempt to integrate them with QGC. The headers become incompatible with QGC, especially if I update QGC’s c_library_v2 submodule to its latest state (or to the commit it requires).
As a result, I get build errors depending on the extent of the differences.

What is the recommended approach to maintain compatibility between PX4-generated MAVLink headers and QGC’s expectations?

Taking a step back, what are you trying to do exactly?

I strongly suggest to update to v1.15.4. You will be missing quite a few important bugfixes.

The c_library_v2 is generated from mavlink/mavlink, so the message definitions will be identical or fairly close to each other. MAVLink messages are usually backwards compatible, e.g. using extensions.

Assuming you want to add some custom messages, you will have to do it for both PX4 and QGC. However, for QGC, you will have to generate the c_library_v2 locally and replace it. Check what happens in CI to reproduce how the c_library_v2 is made:

@JulianOes, thank you for your reply.

To provide some context:
My overall goal is to add a custom MAVLink message (along with a corresponding command) and ensure both QGroundControl (QGC) and PX4 are updated to handle it correctly.

“For QGC, you will have to generate the c_library_v2 locally.”

Yes, I’m doing that — or at least I believe so. I’m using a local clone of the mavlink repository and running the update_c_library.sh script. However, this results in a large number of changes (~480), many of which conflict with the version QGC is based on (Stable 4.4), making integration challenging.

To avoid this, I tried the following approach:

  1. I checked out the specific MAVLink commit that QGC uses.
  2. I updated common.xml with my custom message.
  3. Then I ran update_c_library.sh.

This gives me a clean output that includes my custom message, but it naturally excludes any newer changes made in the PX4 branch of MAVLink. Merging these separately maintained changes seems quite complex.

What confuses me is the compatibility setup:
The message_definitions used to generate c_library_v2 (and used by QGC) seem to differ from the MAVLink definitions used in PX4. If I use PX4’s MAVLink definitions to generate headers for QGC, I encounter compilation errors.

I would appreciate any insights or suggestions to resolve this more cleanly.

Thanks in advance!

I think you want to start off from latest MAVLink. QGC Stable v4.4 should actually be on latest with this commit:

@JulianOes, thanks, the issue was resolved by updating QGC to the latest Stable_V4.4 changes.