Skip to content

Don't treat Paho warnings as errors on GCC/Clang - #27

Merged
Unsttopabull merged 1 commit into
mainfrom
other/paho-no-werror
Nov 9, 2026
Merged

Unsttopabull merged 1 commit into
mainfrom
other/paho-no-werror

Conversation

@Unsttopabull

@Unsttopabull Unsttopabull commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ubuntu-latest now runs on the ubuntu-26.04 image (GCC 15.2, glibc 2.43). There, the Linux build-and-test jobs fail while compiling the fetched paho.mqtt.c v1.3.15:

src/MQTTProtocolOut.c:64:19: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

glibc 2.43 makes strrchr() return const char* when it is given a const char*. Paho assigns the result to a char*.

The warning becomes an error because the openDAQ cmake utils add -Werror to the whole directory with add_compile_options and the Paho targets inherit it.

On Windows we already build Paho with /WX- /W0. This PR gives GCC/Clang the same treatment.
No Paho release fixes this. The line is unchanged in v1.3.16 and on master.

Changes

  • external/paho_mqtt_c/CMakeLists.txt: the per-target loop over the Paho targets now runs on every platform, not only on Windows. The WIN32_LEAN_AND_MEAN/winsock definitions remain Windows-only. MSVC keeps /WX- /W0, and other compilers get -Wno-error. The warning is still printed but no longer fails the build. Only the Paho targets are affected, so module code keeps -Werror.

Testing

  • Ubuntu 26.04.1 container (GCC 15.2, glibc 2.43):
    • Paho v1.3.15 alone with the same directory-wide -Werror: fails on MQTTProtocolOut.c:64 without the change and builds with it.
    • Full module, Debug, with the CI configure line (-DDAQMODULES_MQTT_ENABLE_TESTS=ON -DDAQMODULES_MQTT_DEBUG_WARNINGS_AS_ERRORS=ON -DOPENDAQ_DEBUG_WARNINGS_AS_ERRORS=ON): builds, and MQTTProtocolOut.c now reports a warning instead of an error. test_mqtt_streaming_protocol and test_mqtt_stream_module pass with a local mosquitto.
  • Windows, Visual Studio 18 2026 x64, Debug: builds. The Paho projects still get /WX-, warning level 0 and WIN32_LEAN_AND_MEAN.
  • Release on Linux was not built locally. It takes the same -Werror path (Release warnings-as-errors is on by default).

@Unsttopabull Unsttopabull added the bug Something isn't working label Oct 30, 2026
@Unsttopabull Unsttopabull self-assigned this Oct 30, 2026

@viacheslauK viacheslauK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Unsttopabull
Unsttopabull merged commit 09b141b into main Nov 9, 2026
20 checks passed
@Unsttopabull
Unsttopabull deleted the other/paho-no-werror branch November 9, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants