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
ino prototypes are still emitted above the sketch's #includes on 2.5.15 (#1196 still reproduces) #1275
#1196 was closed on 2026-07-27, but the behaviour it describes still reproduces on fbuild 2.5.15 (released 2026-08-07, eleven days later). Filing separately rather than commenting on a closed issue — happy for this to be folded back into #1196 if that's the better home.
Repro
src/main.ino, with a helper whose return type comes from an included library header:
The prototype at line 3 still precedes the sketch's own #include at line 6.
Note on scope
#1196's example used a sketch-defined type (struct MyStruct). This case is a type from an #included library header, which may be a distinct path through preprocess_ino_files — the prototype block still lands above the include block, which is the part #1196 says should move ("arduino-cli avoids this by inserting prototypes after the include block").
So it's possible the fix addressed sketch-defined types specifically and this variant slipped through, rather than the fix regressing outright.
Context
Found while integrating fbuild into Design Studio for FastLED. Our helper works around this by writing the generated sketch as main.cpp with #include <Arduino.h> prepended instead of main.ino, which skips ino preprocessing entirely — so we're unblocked. Reporting because we'd like to drop that workaround, and because it bites any sketch with a FastLED-typed helper.
Cross-reference: Design Studio for FastLED PR #159 adds a RAM-estimate calibration harness that builds sketches with fbuild and parses fbuild symbols --json output. It works around this bug by writing sketches as main.cpp with #include <Arduino.h> instead of main.ino — a workaround the PR explicitly calls out as something they'd like to drop.
The PR's generated sketches use FastLED types (CRGB, etc.) in helper functions, so the prototype-above-includes ordering is a hard blocker for .ino builds. The harness is gated behind RAM_CALIBRATION=1 and runs 5 test cases × 5 symbol categories = 25 exact comparisons against real Uno builds.
The fix hoists sketch #include directives (like #include <FastLED.h>) into the prelude before auto-generated function prototypes. Your CRGB kelvinToRGB(uint16_t k) helper will now compile correctly — the type is declared before the prototype.
The release is live on PyPI: pip install fbuild==2.5.16 (or uv pip install fbuild==2.5.16).
Thanks for the detailed repro case — it made the fix straightforward!
Activity
zackees commentedon Aug 9, 2026
Cross-reference: Design Studio for FastLED PR #159 adds a RAM-estimate calibration harness that builds sketches with fbuild and parses
fbuild symbols --jsonoutput. It works around this bug by writing sketches asmain.cppwith#include <Arduino.h>instead ofmain.ino— a workaround the PR explicitly calls out as something they'd like to drop.The PR's generated sketches use FastLED types (
CRGB, etc.) in helper functions, so the prototype-above-includes ordering is a hard blocker for.inobuilds. The harness is gated behindRAM_CALIBRATION=1and runs 5 test cases × 5 symbol categories = 25 exact comparisons against real Uno builds.fix(build-engine): hoist sketch #include directives above auto-genera…
zackees commentedon Aug 9, 2026
Fixed in fbuild v2.5.16 🎉
The fix hoists sketch
#includedirectives (like#include <FastLED.h>) into the prelude before auto-generated function prototypes. YourCRGB kelvinToRGB(uint16_t k)helper will now compile correctly — the type is declared before the prototype.The release is live on PyPI:
pip install fbuild==2.5.16(oruv pip install fbuild==2.5.16).Thanks for the detailed repro case — it made the fix straightforward!
fix(ino): never hoist an #include out of its #if
fix(ino): never hoist an #include out of its #if (#1443)