Skip to content

ci(teensy41): all-examples link omits Audio and Adafruit_NeoPixel implementations #3838

Closed

Description

@zackees

The eensy41 all-examples workflow is still red on master, but the current failure set extends beyond the SPI-only scope tracked in #3775.\n\n## Current master evidence\n\n- Master run: https://github.com/FastLED/FastLED/actions/runs/30733721958\n- Commit: d5c784c\n- Workflow input: eensy41 all\n- fbuild: 2.5.6\n- Result: failure\n\nThe same classes of link failures also appear on unrelated PR #3837, confirming that they are baseline failures rather than RP2350 changes.\n\n## Failure classes\n\n### Teensy Audio core symbol is absent\n\nMultiple Audio examples compile and then fail at link:\n\n\nundefined reference to set_audioClock(int, long, unsigned long, bool)'\ncollect2: error: ld returned 1 exit status\n\n\n### Adafruit_NeoPixel implementation is absent\n\nThe compatibility-driver example compiles against the header but fails at link:\n\n\nundefined reference to Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned short, unsigned char, unsigned short)'\nundefined reference to Adafruit_NeoPixel::begin()'\nundefined reference to Adafruit_NeoPixel::show()'\nundefined reference to Adafruit_NeoPixel::~Adafruit_NeoPixel()'\n\n\n### SPI is still absent in some examples\n\nThe same run also retains the SPI link failures already documented in #3775, including SPIClass::begin(), SPIClass::transfer(...), and the global SPI.\n\n## Why this is separate from #3775\n\n#3775 is specifically framed around FastLED's Teensy LPSPI drivers and the missing Teensy SPI library. This issue tracks the broader current CI symptom: multiple framework-library implementations are omitted even when their headers are present, so fixing only the FastLED SPI proxy does not restore the eensy41 all workflow.\n\n## Acceptance criteria\n\n- �ash compile teensy41 all links the Audio examples, the Adafruit_NeoPixel compatibility example, and SPI-dependent examples from a cold cache.\n- The eensy41 GitHub Actions workflow passes on master.\n- The fix does not add per-example include/link workarounds solely to appease the build scanner.\n\nRelated: #3775 and FastLED/fbuild#1214.

Activity

  1. added a commit that references this issue on Aug 6, 2026
    ccbdc9d
  2. zackees commented on Aug 6, 2026

    @zackees
    MemberAuthor

    Reopening — I closed this prematurely.

    PR #3866 used Fixes #3838, but this issue tracks three failure classes and that PR only addresses the first:

    Failure class Status
    Teensy Audio — undefined reference to set_audioClock(...) Fixed by #3866 (merged, ccbdc9de34)
    Adafruit_NeoPixel implementation absent Still failing
    SPI implementations absent (#3775) Still failing

    Verified just now on master at ccbdc9de34 with the Audio fix in place:

    $ bash compile teensy41 --examples SpecialDrivers/Adafruit/AdafruitBridge
    undefined reference to `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned short, unsigned char, unsigned short)'
    undefined reference to `Adafruit_NeoPixel::begin()'
    undefined reference to `Adafruit_NeoPixel::numPixels() const'
    undefined reference to `Adafruit_NeoPixel::setPixelColor(...)'
    undefined reference to `Adafruit_NeoPixel::~Adafruit_NeoPixel()'
    

    The acceptance criteria here explicitly require bash compile teensy41 all to link the Audio examples and the Adafruit_NeoPixel compatibility example and the SPI-dependent examples. Only the first is done.

    Why the remaining two need a different fix

    #3866 worked by vendoring — src/platforms/arm/teensy/audio/ is FastLED-owned code whose README already commits to not depending on the Audio library, so importing the one missing routine restored an invariant we'd broken ourselves. That reasoning does not transfer: Adafruit_NeoPixel and SPI are third-party libraries FastLED should not vendor.

    Those two are the underlying build-system symptom this issue describes — framework-library implementation TUs omitted even when their headers resolve — which is fbuild's library scanner (FastLED/fbuild#1214, FastLED/fbuild#1265). Fixing them here with per-example include/link shims is explicitly ruled out by this issue's own third acceptance criterion.

    So this stays open until teensy41 all links cleanly.

  3. reopened this on Aug 6, 2026
  4. zackees commented on Aug 21, 2026

    @zackees
    MemberAuthor

    Root cause identified — single cause behind all three failure classes

    All three classes in this issue are Teensyduino bundled framework libraries. Teensyduino ships them under framework-arduinoteensy-1.160.0/libraries/ with both headers and sources:

    .../dl-framework-arduinoteensy-1.160.0/.../1.160.0/libraries/
        Adafruit_NeoPixel/Adafruit_NeoPixel.h   + Adafruit_NeoPixel.cpp
        Audio/...                               + *.cpp
        SPI/SPI.h                               + SPI.cpp
    

    fbuild puts that libraries/ tree on the include path but never adds those .cpp files to the link line. So the header resolves, the referencing translation unit compiles, and the symbols are undefined at link. That is exactly the symptom reported here — "multiple framework-library implementations are omitted even when their headers are present" — and it explains Audio, Adafruit_NeoPixel and SPI with one mechanism.

    This also means #3866's vendoring of set_audioClock into src/platforms/arm/teensy/audio/ treated a symptom rather than the cause.

    Minimal local repro (~1 minute, no CI needed)

    bash compile teensy30 --examples SpecialDrivers/Adafruit/AdafruitBridge
    
    undefined reference to `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned short, unsigned char, unsigned short)'
    undefined reference to `Adafruit_NeoPixel::begin()'
    undefined reference to `Adafruit_NeoPixel::show()'
    collect2.exe: error: ld returned 1 exit status
    

    Note this reproduces on teensy30, not just teensy41 — the Adafruit_NeoPixel half currently fails all 8 Teensy workflows (teensy30/31/32/35/36/40/41/LC), which is the bulk of master's current red.

    Why the existing fbuild fix does not cover it

    FastLED/fbuild#1214 — "LDF resolves libraries only from sketch includes — library-source #include <SPI.h> never reaches the link line" — describes this precisely and is closed (2026-08-01). But the symptom persists. I tested both:

    fbuild result
    2.5.18 (currently pinned) fails
    2.5.19 (latest on PyPI) fails

    So this is not a stale-pin problem and bumping the pin does not help.

    The likely distinguishing factor is that FastLED's include is both in library source and inside a preprocessor conditional — src/platforms/adafruit/clockless.cpp.hpp:7:

    #if FL_HAS_INCLUDE(<Adafruit_NeoPixel.h>)
    #include <Adafruit_NeoPixel.h>

    A scanner that skips or cannot evaluate #if blocks would never see the include, while the compiler's __has_include happily resolves it because the header is on the path. That combination is self-reinforcing: the header's presence is what activates the code that needs the missing library.

    Why there is no FastLED-side fix

    The acceptance criteria here rule out the only local options:

    • Adding #include <Adafruit_NeoPixel.h> to the .ino is precisely a "per-example include workaround solely to appease the build scanner".
    • Adding an @filter to exclude the example from Teensy would contradict the criterion that bash compile teensy41 all must link the Adafruit_NeoPixel example.
    • FastLED has no per-example lib_deps mechanism; extra_packages is a CLI flag only, and board-level lib_deps in ci/boards.py would apply the dependency to every Teensy example.

    The fix belongs in fbuild's library resolution: framework libraries/* whose headers are placed on the include path must have their sources compiled when a TU actually references them — including when the #include sits in library source behind a conditional.

  5. zackees commented on Aug 22, 2026

    @zackees
    MemberAuthor

    Investigated the current failure set and reproduced both halves locally (fbuild 2.5.18, teensy41). Posting findings rather than a PR, because the remaining fix needs a maintainer design decision.

    The failure set has shrunk to two sketches

    Master run 32523467223 fails on exactly:

    sketch undefined symbols
    Fx/FxSdCard SPI, SPIClass::begin/end/transfer
    SpecialDrivers/Adafruit/AdafruitBridge Adafruit_NeoPixel::* (7 symbols)

    The Audio class is gone — set_audioClock no longer appears anywhere in the log. #3866 fixed that half. The issue body's three failure classes are now two.

    Both halves are the same root cause

    The Teensy Arduino core bundles both libraries in its own libraries/ folder:

    ~/.fbuild/prod/cache/platforms/dl-framework-arduinoteensy-1.160.0/<hash>/1.160.0/libraries/Adafruit_NeoPixel
    

    So their headers are on the include path while their sources are never compiled. FL_HAS_INCLUDE(<Adafruit_NeoPixel.h>) therefore succeeds and src/platforms/adafruit/clockless.cpp.hpp selects clockless_real.hpp (the AdafruitNeoPixelDriverImpl path) — which then has nothing to link against. Header-availability is being used as a proxy for link-availability, and on Teensy that proxy is wrong.

    This matches FastLED/fbuild#1214 exactly: the LDF resolves libraries only from sketch includes, and that shallow behaviour is deliberate and regression-tested (fbuild#1094).

    New data: the LDF ignores conditional sketch includes

    fbuild#1214's table covered library headers. I measured the sketch case, which it did not:

    form, placed in AdafruitBridge.ino teensy41 result
    no include (current master) ❌ link fails — Adafruit_NeoPixel::* undefined
    plain #include <Adafruit_NeoPixel.h> ✅ links — build succeeded, flash 36864 B
    #if FL_HAS_INCLUDE(<Adafruit_NeoPixel.h>) + include + #endif ❌ link fails — library not selected

    So the scanner counts only unconditional top-level sketch includes. A guard — even one that evaluates true — is enough to make it skip the library.

    That closes off the obvious fix, because the unconditional form breaks every board that lacks the library:

    bash compile uno --examples SpecialDrivers/Adafruit/AdafruitBridge
    src/sketch/AdafruitBridge.ino:8:10: fatal error: Adafruit_NeoPixel.h: No such file or directory
    

    Where this leaves each half

    SPI (FxSdCard) — the vendored SdFat still depends on Arduino SPI (sdfat/fs_sdfat_teensy.h:7, SpiDriver/SdSpiDriver.h:35,99). This is the case fbuild#1214 was closed on, with the verdict "the actual fix for the FastLED breakage belongs on the FastLED side — the Teensy 4.x driver should not depend on the Arduino SPI library in the first place" — i.e. #3777. Adding #include <SPI.h> to the sketch would link, but that is precisely the per-example scanner workaround this issue's acceptance criteria forbid.

    Adafruit (AdafruitBridge) — needs a decision, and I do not think an agent should pick unilaterally:

    1. Make the include unconditional and restrict the example to boards that ship the library. Honest about the dependency, but gives up the everywhere-compiles coverage that currently exercises clockless_fake.hpp.
    2. Stop keying the real/fake driver switch on header presence alone, so a visible-but-unlinkable header falls back to the fake driver. Keeps coverage, but there is no portable compile-time test for "will link".
    3. Vendor the small amount of Adafruit_NeoPixel that the bridge actually uses, mirroring what fix(teensy4): vendor set_audioClock instead of the Audio library #3866 did for set_audioClock.

    (3) is the closest match to the precedent already set in this repo, but it is the most work and changes what the "bridge" means.

    Happy to implement whichever you prefer.

  6. zackees commented on Aug 22, 2026

    @zackees
    MemberAuthor

    Another library omitted by the same all-examples link: SPI, hit via Fx/FxSdCard.

    ld: .lto-tmp/cc0fCeWu.ltrans1.ltrans.o: in function `fl::platforms::teensy::FsSdFatTeensy::begin()':
    <artificial>:(.text+0xb90): undefined reference to `SPIClass::begin()'
    collect2: error: ld returned 1 exit status
    FAILED: Fx/FxSdCard
    

    Confirmed pre-existing on master, not PR-specific — the identical failure (same example, same symbol) appears on master 9d29d77966 (2026-08-21, job 96636629459) and reproduces on current master-based branches. So the teensy41 / build / build check is red on master independently of any given PR.

    Same shape as the Audio and Adafruit_NeoPixel cases in this issue: the header/class is visible to the compile, but the library's implementation objects are not in the link. Note #3775 covered SPIClass for SpiHw2/4MXRT1062 and was closed — this is the same library going missing again, from a different consumer (FsSdFatTeensy), which suggests the fix there addressed the call site rather than the library-inclusion rule.

  7. zackees commented on Aug 22, 2026

    @zackees
    MemberAuthor

    Post-#3966 status: 4 of 8 teensy boards are green

    f10a1e77 (the Adafruit fix) is on master. Results across all eight boards:

    board before after remaining cause
    teensy30, teensy31, teensy32, teensyLC ❌ ✅ green —
    teensy35, teensy36, teensy40, teensy41 ❌ ❌ SPI only

    All four still-red boards now fail on exactly one sketch, Fx/FxSdCard, with zero Adafruit symbols. The Adafruit half is fully closed.

    Correcting my earlier comment: I predicted teensy35/36 would go green. That was wrong — I had sampled only teensy30 (Adafruit-only) and teensy40 (Adafruit + SPI) and generalised by chip family. 3.5 and 3.6 carry the SdFat/SPI dependency too.

    lib_deps does not work for this, measured

    fbuild#1214 suggested honouring lib_deps in the Teensy orchestrator as the way for a project to declare a dependency the finder cannot infer. I tested whether that route is open today:

    TEENSY35 = Board(board_name="teensy35", platform="teensy",
                     framework="arduino", lib_deps=["SPI"])

    The declaration reaches the generated ini correctly (.build/pio/teensy35/platformio.ini:16: lib_deps = SPI), and the link errors do disappear — but the build fails earlier:

    build error: package error: library 'SPI' not found in registry
    

    fbuild resolves lib_deps names against the PlatformIO registry, so it cannot name a library that ships inside the framework's own libraries/ folder — which is exactly where the Teensy core keeps SPI (and Adafruit_NeoPixel). So lib_deps is not a usable escape hatch for core-bundled libraries even where it is honoured.

    What is left, and why I stopped

    sdfat/fs_sdfat_teensy.h:7 and SpiDriver/SdSpiDriver.h:35,99 bind the vendored SdFat to Arduino SPIClass. The options all trade something away:

    1. Gate the Teensy SdFat backend behind a build-level define, mirroring what fix(adafruit): unbreak all teensy builds + make README badges honest (#3838) #3966 did for Adafruit. file_system_sd.cpp.hpp:76-84 already has the graceful fallback (weak make_sdcard_filesystem returns null, beginSd() returns false), so this is a small, symmetric change and turns all eight boards green. Cost: a project that gets SD on Teensy today — which works only if its sketch happens to include <SPI.h> — loses it silently until it adds the define.
    2. #include <SPI.h> in FxSdCard.ino. Idiomatic for an Arduino SD-over-SPI sketch and declares a real dependency, but it is the per-example include the acceptance criteria rules out.
    3. Skip FxSdCard on Teensy sweeps. Turns CI green while hiding a real limitation.
    4. teensy4: drop the Arduino SPI library dependency from SpiHw2/4MXRT1062 (local fork, like PJRC audio + SdFat) — real fix for #3775 #3777 proper — give the vendored SdFat a FastLED-owned SPI backend and drop SPIClass. The only option with no downside, and much the largest.

    (1) is my recommendation for unblocking CI now, with (4) as the real fix. I have not implemented any of them, because each changes user-visible behaviour or overrules this issue's stated criteria, and that is a maintainer call rather than mine.

  8. zackees commented on Aug 22, 2026

    @zackees
    MemberAuthor

    Resolved. All eight Teensy board workflows are green on master at 3de8d4f8:

    build_teensy30   success      build_teensy36   success
    build_teensy31   success      build_teensyLC   success
    build_teensy32   success      build_teensy40   success
    build_teensy35   success      build_teensy41   success
    

    build_teensy41.yml runs args: teensy41 all — the full example sweep, not a subset — and run 32603770094 passed.

    Acceptance criteria

    • teensy41 all links the Audio examples, the Adafruit_NeoPixel example, and the SPI-dependent examples from a cold cache — the CI run above is exactly this
    • The teensy41 workflow passes on master — first green at 54107f0b, still green at 3de8d4f8
    • No per-example include/link workarounds added to appease the build scanner — this was tried and explicitly rejected: PR fix(examples): declare the SPI dependency in FxSdCard — takes teensy to 8/8 green (#3838) #3969 added #include <SPI.h> to FxSdCard.ino, and was closed both because it violated this criterion and because it broke the host build ('SPI.h' file not found on the stub platform)

    Root cause, for the record

    All three failure classes in the issue body were one mechanism. The Teensy Arduino core bundles 92 libraries inside framework-arduinoteensy, including Audio, Adafruit_NeoPixel and SPI. Their headers are always on the include path, so FL_HAS_INCLUDE succeeds and FastLED compiles against them — but their sources are compiled only when the dependency finder selects the library, and it selects only from unconditional includes in the sketch (FastLED/fbuild#1214, a deliberate tested invariant). Header visibility never implied linkability.

    Fixed in three passes, each removing the dependency rather than declaring it:

    class fix
    set_audioClock #3866 — vendored the one PLL4 routine, dropped the external include
    Adafruit_NeoPixel::* #3966 — real driver now needs a build-level opt-in; header presence alone no longer selects it
    SPIClass::* / ctar_*_table #3971 → #3973 (Teensy 4, LpspiBus) and #3972 → #3979 (Teensy 3.x/LC, DspiBus)

    Vendoring Arduino's SPI was never an option — it is GPLv2/LGPLv2.1 and FastLED is MIT — so both bus classes are FastLED's own register code, with DSPI CTAR values computed from the K20/K64/K66 reference manual rather than transcribed.

    Caveat

    Green CI here means links, not works. None of the SdFat SPI transport has run on hardware; LpspiBus::transfer() and DspiBus::transfer() have never returned a byte from a real card. Bench validation for Teensy 4.0/4.1 is tracked in #3983. Teensy 3.5/3.6 and LC are out of production and will not be bench-tested — bug reports welcome if that path misbehaves, and #3987 adds a compile-time notice to set that expectation.

  9. moved this from Triage to Done in FastLED Trackeron Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions