Skip to content

MdnsBrowser not declared compilation error in CLI tools when ENABLE_MDNS is false #2024

Description

@dmas11
  • I confirm that this is an issue rather than a question.

Bug report

MdnsBrowser not declared compilation error in CLI tools when ENABLE_MDNS is false

Steps to reproduce

  1. Configure cmake without MDNS support (e.g. missing dependencies, causing ENABLE_MDNS=OFF)
  2. Run make
  3. Compile fails at hyperion-remote.cpp (and all subsequent CLI tools) at the MdnsBrowser::isMdns check.

What is expected?

The if (MdnsBrowser::isMdns(hostName)) block should be guarded by #ifdef ENABLE_MDNS, matching the #include guards at the top of the files. The codebase should compile successfully even when ENABLE_MDNS is false.

What is actually happening?

The build fails with an error: 'MdnsBrowser' has not been declared.

This occurs because MdnsBrowser::isMdns(hostName) is called directly without being wrapped in an #ifdef ENABLE_MDNS block, even though the header #include <mdns/MdnsBrowser.h> is properly #ifdef guarded at the top of the files.

Files affected:

  • src/hyperion-remote/hyperion-remote.cpp
  • src/hyperion-drm/hyperion-drm.cpp
  • src/hyperion-framebuffer/hyperion-framebuffer.cpp
  • src/hyperion-v4l2/hyperion-v4l2.cpp
  • src/hyperion-x11/hyperion-x11.cpp
  • src/hyperion-xcb/hyperion-xcb.cpp
  • src/hyperion-aml/hyperion-aml.cpp
  • src/hyperion-dispmanx/hyperion-dispmanx.cpp
  • src/hyperion-osx/hyperion-osx.cpp
  • src/hyperion-qt/hyperion-qt.cpp

Proposed fix:
Wrap the block in all 10 files like so:

#ifdef ENABLE_MDNS
if (MdnsBrowser::isMdns(hostName)) {
    NetUtils::discoverMdnsServices("...");
}
#endif

System

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions