You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ESP8266: a sketch using a bundled core library (ESP8266WiFi) fails at link; library sources are never compiled (2.5.51) #1994
On fbuild 2.5.51, an ESP8266 sketch that includes one of the core's bundled libraries (ESP8266WiFi, ESP8266WebServer, ESP8266mDNS, WiFiUdp) compiles and then fails to link, with undefined references to that library's symbols. A sketch with no such include builds, deploys and runs: a LOLIN D1 mini flashed through fbuild deploy on 2.5.51 works. Arduino CLI builds the same Wi-Fi sketches.
$ fbuild <project> build -e nodemcuv2 --no-timestamp
Board: NodeMCU 1.0 (ESP-12E Module) / ESP8266 @ 80MHz
Compiled 1/1 files
Compiled 83/83 files
Linking firmware.elf
build error: build failed: xtensa-lx106-elf-gcc link failed:
undefined reference to `WiFi'
undefined reference to `_ZN19ESP8266WiFiSTAClass5beginEPKcS1_iPKhb'
undefined reference to `_ZN23ESP8266WiFiGenericClass4modeE8WiFiMode'
collect2.exe: error: ld returned 1 exit status
The same happens with board = d1_mini, and with ESP8266WebServer.h and ESP8266mDNS.h (undefined WiFiClient, WiFiServer, MDNSResponder, ESP8266WebServerTemplate symbols).
Environment
fbuild 2.5.51+git.9b26affea5ad, Windows 11. Also on a GitHub windows-latest runner.
Lines 414-428 add every bundled library's src directory to the include path (// Built-in Arduino libraries (ESP8266WiFi, etc.)), so the sketch compiles against the headers.
The build then calls pipeline::run_sequential_build_with_libs(&compiler, &linker, ctx, params, &sources, &[], lib_deps_plan, Some(&lib_env), ...). sources holds the core and the sketch, and extra_link_inputs is empty. Nothing compiles the bundled libraries' .cpp files.
The build tree agrees: .fbuild/build/nodemcuv2/release/ holds core/ and src/ only, and the log shows 83 core files and one sketch file compiled. The ESP32 build selects and compiles framework libraries from the sketch's includes (framework-libs cache: stored N in its log); the ESP8266 build has no such step. run_sequential_build_with_libs delegates to run_sequential_build_with_optional_framework_libs, so the hook may already be there.
Expected
The bundled libraries a sketch's include graph reaches are compiled and linked, as on ESP32.
Confirmed with your repro, board = nodemcuv2, pinned espressif8266 (framework-arduinoespressif8266 3.1.2, xtensa-lx106-elf 3.2.0-gcc10.3): your diagnosis is exactly right — the bundled libraries' include dirs were on the search path, but nothing compiled their sources. fbuild build compiled 83 core + 1 sketch files and then died with the same undefined reference to WiFi / ESP8266WiFiSTAClass::begin.
Fix (#1995): the ESP8266 orchestrator now runs the same library-dependency finder the Teensy/STM32/RP2040 paths use, seeded from the project's translation units (lib_deps and active #if branches honored), and adds the reached libraries' sources to the core compile set. Unreached libraries are not compiled.
Thanks for the precise write-up — the file/line pointers made this a one-pass fix. I have not flashed the WiFi image to a LOLIN D1 mini (only the plain sketch runs on hardware here), so if you can re-run your fbuild deploy on 2.5.52+ once #1995 lands, that closes the loop.
Confirmed on hardware with 2.5.52: a LOLIN D1 mini built and flashed through fbuild with a sketch that uses ESP8266WiFi, ESP8266WebServer and ESP8266mDNS.
fbuild build -e esp8266_esp8266_d1_mini: linked in 72.6 s, flash 361,311 bytes, RAM 31,676 bytes. No undefined reference to WiFiClient any more.
fbuild deploy -p COM8 --skip-build: esptool v5.3.0 wrote 365,408 bytes (263,315 compressed) in 23.7 s, hash verified, hard reset via RTS.
On boot the board joined Wi-Fi, answered on mDNS as fastled-board.local, and served its web page. A phone and a desktop browser could both drive the LEDs through it. A POST to the sketch's /set route was applied and read back.
Thanks for the quick fix in #1995. From our side this one can be closed.
Activity
docs: link the ESP8266 Wi-Fi link failure to FastLED/fbuild#1994
zackees commentedon Nov 11, 2026
Reproduced on Linux and fixed in #1995.
Confirmed with your repro,
board = nodemcuv2, pinnedespressif8266(framework-arduinoespressif8266 3.1.2, xtensa-lx106-elf 3.2.0-gcc10.3): your diagnosis is exactly right — the bundled libraries' include dirs were on the search path, but nothing compiled their sources.fbuild buildcompiled 83 core + 1 sketch files and then died with the sameundefined reference to WiFi/ESP8266WiFiSTAClass::begin.Fix (#1995): the ESP8266 orchestrator now runs the same library-dependency finder the Teensy/STM32/RP2040 paths use, seeded from the project's translation units (
lib_depsand active#ifbranches honored), and adds the reached libraries' sources to the core compile set. Unreached libraries are not compiled.On the same toolchain after the fix:
#include <ESP8266WiFi.h>+WiFi.begin(...)ESP8266WiFisources compiled#include <ESP8266WebServer.h>+server.begin()ESP8266WebServer+ESP8266WiFitransitivelyThanks for the precise write-up — the file/line pointers made this a one-pass fix. I have not flashed the WiFi image to a LOLIN D1 mini (only the plain sketch runs on hardware here), so if you can re-run your
fbuild deployon 2.5.52+ once #1995 lands, that closes the loop.stevenmunn312-tech commentedon Nov 19, 2026
Sorry for the delay getting this onto the bench.
Confirmed on hardware with 2.5.52: a LOLIN D1 mini built and flashed through fbuild with a sketch that uses
ESP8266WiFi,ESP8266WebServerandESP8266mDNS.fbuild build -e esp8266_esp8266_d1_mini: linked in 72.6 s, flash 361,311 bytes, RAM 31,676 bytes. Noundefined reference to WiFiClientany more.fbuild deploy -p COM8 --skip-build: esptool v5.3.0 wrote 365,408 bytes (263,315 compressed) in 23.7 s, hash verified, hard reset via RTS.fastled-board.local, and served its web page. A phone and a desktop browser could both drive the LEDs through it. A POST to the sketch's/setroute was applied and read back.Thanks for the quick fix in #1995. From our side this one can be closed.