Skip to content

fdiagnostics-color in extra_flags causes break in library resolver #3020

@Electro707

Description

@Electro707

Describe the problem

When -fdiagnostics-color=always is added as part of the build extra flags, the library resolver/processor is unable to resolve any libraries.

This is because, if I copy the output to the clipboard, the resolver seems to include the ANSI escape code in the library name:

Image

To reproduce

with an example sketch such as

#include <Arduino.h> #include <SPI.h> void setup(void){ Serial.begin(115200); Serial.println("HI!"); } void loop(void){ } 

run

arduino-cli compile -v \	--build-property "compiler.c.extra_flags=-fdiagnostics-color=always" \	--build-property "compiler.cpp.extra_flags=-fdiagnostics-color=always" \	--fqbn ArduinoCore-avr:avr:uno \	testArduinoCliBug.ino 

Expected behavior

The ANSI sequence should be escaped/removed from the library

Arduino CLI version

r2843.20e315c2f

Operating system

Linux

Operating system version

Arch Linux

Additional context

From initial code research the most likely candidate for the fault is in internal/arduino/builder/internal/detector/detector.go, possibly in the function IncludesFinderWithRegExp or the thing calling it.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions