Move logging.h out of WiFiServer's extern "C" block#5
Merged
Conversation
`logging.h` declares `arduino::log(...)` in a C++ namespace. With it inside
`extern "C" { ... }`, that declaration ends up with C linkage, which then
collides with libc's `extern "C" double log(double)` from <math.h> (pulled
transitively via Arduino.h -> <memory> -> <cmath>). Apple Clang reports it
as `error: conflicting types for 'log'` and aborts; Linux GCC silently
tolerates the misuse, which is why this never surfaced before.
Hit while bringing up the macOS-native portduino build (firmware PR
meshtastic/firmware#10300). The other two cpp files in this library are
already correct: `WiFiClient.cpp` includes logging.h after its extern "C"
block, and `WiFiUdp.cpp` doesn't pull logging.h at all.
This was referenced Apr 26, 2026
thebentern
added a commit
to meshtastic/framework-portduino
that referenced
this pull request
Apr 26, 2026
The WiFi submodule's WiFiServer.cpp had `#include "logging.h"` inside an
`extern "C" { ... }` block, which gives `arduino::log(...)` C linkage and
collides with libc's `extern "C" double log(double)` from <math.h> under
Apple Clang ("conflicting types for 'log'"). Fixed in
meshtastic/WiFi#5; this commit bumps the submodule pointer to that change.
Once this is on master, the next steps are: bump platform-native's
framework-portduino pin (meshtastic/platform-native), then drop the
bin/patch-framework-portduino-darwin.py workaround in firmware PR
meshtastic/firmware#10300 and bump platform-native's zip pin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WiFiServer.cppcurrently does:logging.hdeclaresarduino::log(...)in a C++ namespace. With the include insideextern "C" { ... }, that declaration ends up with C linkage and then collides with libc'sextern "C" double log(double)from<math.h>— pulled transitively viaArduino.h→<memory>→<cmath>. Apple Clang reportserror: conflicting types for 'log'and aborts; Linux GCC silently tolerates the misuse, which is why this never surfaced before.This PR moves
#include "logging.h"outside theextern "C"block (matching the placement thatWiFiClient.cppalready uses at line 30) and adds a comment explaining why future edits must not relocate it back inside.Context
Hit while bringing up the macOS-native portduino build — see firmware PR meshtastic/firmware#10300 for the full bring-up. The other two
.cppfiles in this library are already correct:WiFiClient.cpp—#include "logging.h"is at line 30, after itsextern "C"block at line 20–25. No change.WiFiUdp.cpp— does not includelogging.hat all. No change.After this lands
The downstream cleanup chain is:
meshtastic/framework-portduino— bump thelibraries/WiFisubmodule pointer to the merged commit.meshtastic/platform-native— bump theframework-portduinogit ref inplatform.json.meshtastic/firmwarePR #10300 — dropbin/patch-framework-portduino-darwin.pyand itsextra_scriptsentry in[env:native-macos], then bumpportduino_base.platformto the newplatform-nativecommit.Test plan
meshtasticdcleanly on macOS arm64 (Apple Clang) — the firmware-side pre-build patcher applies the equivalent reordering and the resulting binary boots in SimRadio mode.🤖 Generated with Claude Code