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
Compiler output and errors should be broken apart into separate JSON elements so to allow parsing by a computer.
Here is a rough example of how I could see it working. This has a pretty complicated output for the "compiler_out" section, but I wanted to show a potential way of offering a complete breakdown of the output.
Breaking individual compiler commands and errors into separate elements in the machine readable output formats makes it much easier to parse.
Describe the current behavior
Demonstration Sketch
voidsetup(){
a++;
}
voidloop(){
b++
}
(Errors are deliberate to cause compile to fail.)
Demo
$ arduino-cli versionarduino-cli.exe Version: git-snapshot Commit: b3e8f8a4 Date: 2023-01-17T06:37:36Z$ arduino-cli compile -b "arduino:avr:uno" -v --warnings all --format json /tmp/FooSketch
{
"compiler_out": "Using board 'uno' from platform in folder: C:\\Users\\Gabe\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\nUsing core 'arduino' from platform in folder: C:\\Users\\Gabe\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\nDetecting libraries used...\n\"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\tools\\\\avr-gcc\\\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++\" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\cores\\\\arduino\" \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\variants\\\\standard\" \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\sketch\\\\test.ino.cpp\" -o nul\nGenerating function prototypes...\n\"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\tools\\\\avr-gcc\\\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++\" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\cores\\\\arduino\" \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\variants\\\\standard\" \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\sketch\\\\test.ino.cpp\" -o \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\preproc\\\\ctags_target_for_gcc_minus_e.cpp\"\n\"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\builtin\\\\tools\\\\ctags\\\\5.8-arduino11/ctags\" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\preproc\\\\ctags_target_for_gcc_minus_e.cpp\"\nCompiling sketch...\n\"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\tools\\\\avr-gcc\\\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++\" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\cores\\\\arduino\" \"-IC:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\arduino\\\\hardware\\\\avr\\\\1.8.6\\\\variants\\\\standard\" \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\sketch\\\\test.ino.cpp\" -o \"C:\\\\Users\\\\Gabe\\\\AppData\\\\Local\\\\Temp\\\\arduino\\\\sketch-2405C4C9F90028537C79B0744BCE536E\\\\sketch\\\\test.ino.cpp.o\"\n",
"compiler_err": "C:\\Users\\Gabe\\AppData\\Local\\Temp\\FooSketch\\test.ino: In function 'void setup()':\r\nC:\\Users\\Gabe\\AppData\\Local\\Temp\\FooSketch\\test.ino:2:5: error: 'a' was not declared in this scope\r\n a++;\r\n ^\r\nC:\\Users\\Gabe\\AppData\\Local\\Temp\\FooSketch\\test.ino: In function 'void loop()':\r\nC:\\Users\\Gabe\\AppData\\Local\\Temp\\FooSketch\\test.ino:6:5: error: 'b' was not declared in this scope\r\n b++\r\n ^\r\n\n",
"builder_result": {
"build_path": "C:\\Users\\Gabe\\AppData\\Local\\Temp\\arduino\\sketch-2405C4C9F90028537C79B0744BCE536E",
"board_platform": {
"id": "arduino:avr",
"version": "1.8.6",
"install_dir": "C:\\Users\\Gabe\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6"
},
"build_platform": {
"id": "arduino:avr",
"version": "1.8.6",
"install_dir": "C:\\Users\\Gabe\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6"
}
},
"success": false,
"error": "Error during build: exit status 1"
}
🙁 It is difficult to parse the machine readable output from the compile command because the individual compiler commands and errors are all combined into the same field.
This is a pretty big undertaking, and could take time to implement. Ideally, the error output is tackled first, as it is more likely to be useful for the most people.
Describe the request
Compiler output and errors should be broken apart into separate JSON elements so to allow parsing by a computer.
Here is a rough example of how I could see it working. This has a pretty complicated output for the
"compiler_out"
section, but I wanted to show a potential way of offering a complete breakdown of the output.Possible JSON output structure
Breaking individual compiler commands and errors into separate elements in the machine readable output formats makes it much easier to parse.
Describe the current behavior
Demonstration Sketch
(Errors are deliberate to cause compile to fail.)
Demo
🙁 It is difficult to parse the machine readable output from the
compile
command because the individual compiler commands and errors are all combined into the same field.Arduino CLI version
Original report
0.14.0
Last verified with
b3e8f8a
Operating system
Windows
Operating system version
10, 11
Additional context
This is a pretty big undertaking, and could take time to implement. Ideally, the error output is tackled first, as it is more likely to be useful for the most people.
Issue checklist
The text was updated successfully, but these errors were encountered: