Fix nRF52 builds broken by unconditional RAK Ethernet include#2989
Merged
Conversation
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
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.
Problem
Since #1983 merged, all non-Ethernet nRF52 targets fail to build (reported in #2985 for Heltec T114, but it affects every nRF52 board):
Root cause
PlatformIO compiles every
.cppundersrc/, regardless of whether it's referenced.src/helpers/nrf52/SerialEthernetInterface.cppincludesSerialEthernetInterface.h, which unconditionally does#include <RAK13800_W5100S.h>— a library only present in the RAK4631 Ethernet env'slib_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_ENABLEDand provide the W5100S library, so the breakage only shows on other nRF52 variants that share thesrc/tree.Fix
Wrap the contents of both
SerialEthernetInterface.handSerialEthernetInterface.cppin#ifdef ETHERNET_ENABLED, so on non-Ethernet builds they become empty translation units and never reach theRAK13800_W5100S.hinclude. RAK4631 Ethernet envs defineETHERNET_ENABLEDand are unchanged.Thanks to @enigmaspb for the diagnosis and proposed fix in #2985.
Verification
Local
pio run, before → after:Heltec_t114_without_display_companion_radio_usbRAK_4631_companion_radio_ethernetFixes #2985