Skip to content

postvariant.h include of Arduino_RouterBridge causes DebugLog 'Serial' not declared error in Zephyr 0.55.0 #492

Description

@hybotix

With Zephyr 0.55.0, postvariant.h includes Arduino_RouterBridge.h at line 21, which triggers the following transitive include chain inside Arduino.h before Serial is fully defined:

Arduino.h (line 172)
  → postvariant.h (line 21)
    → Arduino_RouterBridge.h (line 16)
      → bridge.h (line 32)
        → Arduino_RPClite.h (line 22)
          → client.h (line 14)
            → error.h (line 20)
              → MsgPack.h (line 5)
                → DebugLog.h (line 17)
                  → DebugLog/Manager.h (line 18)  ← Serial not yet defined

DebugLog/Manager.h line 18 contains:

Stream* stream {&Serial};

This is a non-static data member default initializer that references Serial at header parse time. Because this include chain is now triggered from inside Arduino.h before Serial is defined, compilation fails on any sketch that uses Arduino_RouterBridge — which is mandatory for Zephyr 0.55.0.

Full error output:

In file included from /Arduino/libraries/DebugLog/DebugLog.h:17,
                 from /Arduino/libraries/MsgPack/MsgPack.h:5,
                 from /Arduino/libraries/Arduino_RPClite/src/error.h:20,
                 from /Arduino/libraries/Arduino_RPClite/src/client.h:14,
                 from /Arduino/libraries/Arduino_RPClite/src/Arduino_RPClite.h:22,
                 from /.arduino15/internal/Arduino_RouterBridge_0.4.1_.../src/bridge.h:32,
                 from /.arduino15/internal/Arduino_RouterBridge_0.4.1_.../src/Arduino_RouterBridge.h:16,
                 from /.arduino15/packages/arduino/hardware/zephyr/0.55.0/variants/arduino_uno_q_stm32u585xx/postvariant.h:21,
                 from /.arduino15/packages/arduino/hardware/zephyr/0.55.0/cores/arduino/Arduino.h:172:
/Arduino/libraries/DebugLog/DebugLog/Manager.h:18:26: error: 'Serial' was not declared in this scope; did you mean 'Serial2'?
   18 |         Stream* stream {&Serial};
      |                          ^~~~~~
      |                          Serial2
/Arduino/libraries/DebugLog/DebugLog/Manager.h:18:32: error: cannot convert '<brace-enclosed initializer list>' to 'arduino::Stream*' in initialization
   18 |         Stream* stream {&Serial};
      |                                ^

Steps to reproduce:

  1. Install Zephyr platform 0.55.0 on Arduino UNO Q
  2. Install Arduino_RouterBridge 0.4.1, Arduino_RPClite 0.2.1, DebugLog 0.8.4
  3. Compile any sketch that includes Arduino_RouterBridge.h

Expected behavior:

Compilation succeeds. Serial is available at the point DebugLog/Manager.h is parsed.

Root cause:

Prior to Zephyr 0.55.0, Arduino_RouterBridge.h was only included explicitly by sketches — after Arduino.h had fully initialized Serial. The 0.55.0 introduction of postvariant.h including Arduino_RouterBridge.h from inside Arduino.h broke this assumption for any library that transitively depends on DebugLog. DebugLog 0.8.4 is the latest available version and has no fix for this.

Suggested fix:

Either:

  1. Move the Arduino_RouterBridge include in postvariant.h to after Serial is defined in Arduino.h, or
  2. Remove the DebugLog dependency from Arduino_RPClite headers — DebugLog should only be pulled in at .cpp level, not through header includes

Environment:

  • Board: Arduino UNO Q
  • Platform: arduino:zephyr 0.55.0
  • Arduino_RouterBridge: 0.4.1
  • Arduino_RPClite: 0.2.1
  • DebugLog: 0.8.4 (latest)
  • OS: Linux arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions