Skip to content

Fix nRF52 builds broken by unconditional RAK Ethernet include#2989

Merged
liamcottle merged 1 commit into
meshcore-dev:devfrom
rgregg:fix-nrf52-ethernet-build
Jul 20, 2026
Merged

Fix nRF52 builds broken by unconditional RAK Ethernet include#2989
liamcottle merged 1 commit into
meshcore-dev:devfrom
rgregg:fix-nrf52-ethernet-build

Conversation

@rgregg

@rgregg rgregg commented Jul 19, 2026

Copy link
Copy Markdown

Problem

Since #1983 merged, all non-Ethernet nRF52 targets fail to build (reported in #2985 for Heltec T114, but it affects every nRF52 board):

In file included from src/helpers/nrf52/SerialEthernetInterface.cpp:1:
src/helpers/nrf52/SerialEthernetInterface.h:5: fatal error: RAK13800_W5100S.h: No such file or directory

Root cause

PlatformIO compiles every .cpp under src/, regardless of whether it's referenced. src/helpers/nrf52/SerialEthernetInterface.cpp includes SerialEthernetInterface.h, which unconditionally does #include <RAK13800_W5100S.h> — a library only present in the RAK4631 Ethernet env's lib_deps. Any other nRF52 board compiles the file, can't find the library, and fails.

The RAK4631 Ethernet envs weren't affected because they define ETHERNET_ENABLED and provide the W5100S library, so the breakage only shows on other nRF52 variants that share the src/ tree.

Fix

Wrap the contents of both SerialEthernetInterface.h and SerialEthernetInterface.cpp in #ifdef ETHERNET_ENABLED, so on non-Ethernet builds they become empty translation units and never reach the RAK13800_W5100S.h include. RAK4631 Ethernet envs define ETHERNET_ENABLED and are unchanged.

Thanks to @enigmaspb for the diagnosis and proposed fix in #2985.

Verification

Local pio run, before → after:

Environment Before After
Heltec_t114_without_display_companion_radio_usb FAILED SUCCESS
RAK_4631_companion_radio_ethernet SUCCESS SUCCESS

Fixes #2985

SerialEthernetInterface.cpp is compiled for every nRF52 target because
PlatformIO builds all .cpp files under src/. It includes
SerialEthernetInterface.h, which unconditionally pulls in
<RAK13800_W5100S.h> -- a library only present in the RAK4631 Ethernet
env's lib_deps. As a result any other nRF52 board (e.g. Heltec T114)
fails to build with 'RAK13800_W5100S.h: No such file or directory'.

Wrap the contents of both files in '#ifdef ETHERNET_ENABLED' so they
compile to empty translation units on non-Ethernet builds. RAK4631
Ethernet envs define ETHERNET_ENABLED and are unaffected.

Fixes meshcore-dev#2985
@liamcottle
liamcottle merged commit fdd4d8a into meshcore-dev:dev Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants