Skip to content

Fix Arduino CLI preprocess handling in SDCC wrapper#190

Closed
DeqingSun with Copilot wants to merge 2 commits into
ch55xduinofrom
copilot/fix-arduino-cli-compile-all-job
Closed

Fix Arduino CLI preprocess handling in SDCC wrapper#190
DeqingSun with Copilot wants to merge 2 commits into
ch55xduinofrom
copilot/fix-arduino-cli-compile-all-job

Conversation

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown

The arduino-cli_compile_all Actions job was failing during sketch preprocessing and library detection, before normal compilation began. The failure came from the SDCC wrapper not handling Arduino CLI's preprocess invocation shape correctly.

  • Root cause

    • arduino-cli invokes the wrapper in preprocess mode (-E) for generated sketch output and library detection.
    • The wrapper treated these calls like regular compiles, which caused:
      • missing preprocessed output files such as sketch_merged.cpp
      • -MF ...libsdetect.d being passed through to SDCC as if it were a normal input/output argument
  • Wrapper changes

    • detect preprocess invocations in sdcc.sh
    • strip -MF <depfile> before invoking SDCC
    • write preprocess stdout to the requested Arduino CLI output file
    • when Arduino CLI uses /dev/null for output during lib detection, redirect SDCC's dependency side effects to the depfile stem instead
  • Behavior preserved

    • leave normal compile/link flows unchanged
    • skip .rel copy/alignment logic for preprocess-only runs
  • Example

    # Arduino CLI preprocess / library-detect style call
    sdcc.sh sdcc sketch.cpp /dev/null re12 -MMD -E -MC -MF sketch.cpp.libsdetect.d
    
    # Wrapper now:
    # - removes -MF from the SDCC argv
    # - preserves preprocess output handling
    # - uses the depfile stem for SDCC's output-side dependency generation

Copilot AI changed the title [WIP] Fix failing GitHub Actions job arduino-cli_compile_all Fix Arduino CLI preprocess handling in SDCC wrapper Jul 4, 2026
Copilot AI requested a review from DeqingSun July 4, 2026 20:19
@DeqingSun DeqingSun marked this pull request as ready for review July 4, 2026 20:23
@DeqingSun DeqingSun closed this Jul 4, 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