Skip to content

The error output from the compilation is not always in the json output of the compile command #1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Renaud11232 opened this issue Apr 16, 2021 · 1 comment
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@Renaud11232
Copy link

Renaud11232 commented Apr 16, 2021

Bug Report

Current behavior

When compiling a sketch with missing libraries using the --format json flag, the error output is on stderr instead of being in the json output.

Test.ino :

#include "Dummy.h"

void setup() {
}

void loop() {
}

Compiling with the following command :

.\arduino-cli_0.18.0_Windows_64bit\arduino-cli.exe compile --format json --fqbn arduino:avr:mega:cpu=atmega2560 Test

Gives the following output :

stdout

{
  "compiler_out": "",
  "compiler_err": "",
  "builder_result": {
    "build_path": "C:\\Users\\gaspa\\AppData\\Local\\Temp\\arduino-sketch-2422F2901866CFBFF08F6C5D307E5DE3"
  },
  "success": false
}

stderr

C:\Users\gaspa\Downloads\Test\Test.ino:1:10: fatal error: Dummy.h: No such file or directory
 #include "Dummy.h"
          ^~~~~~~~~
compilation terminated.

Expected behavior

The error output should be printed on stdout in the json ouput
i.e:

{
  "compiler_out": "",
  "compiler_err": "C:\\Users\\gaspa\\Downloads\\Test\\Test.ino:1:10: fatal error: Dummy.h: No such file or directory\r\n#include \"Dummy.h\"\r\n          ^~~~~~~~~\r\ncompilation terminated.",
  "builder_result": {
    "build_path": "C:\\Users\\gaspa\\AppData\\Local\\Temp\\arduino-sketch-2422F2901866CFBFF08F6C5D307E5DE3"
  },
  "success": false
}

Environment

  • CLI version : arduino-cli.exe alpha Version: 0.18.0 Commit: 46c23166 Date: 2021-03-31T09:42:54Z
  • OS and platform: Windows 64bit as well as Linux ARMv6

Additional context

This might be caused by #174

Thanks

@per1234
Copy link
Contributor

per1234 commented Mar 25, 2022

I'm happy to report that this bug no longer occurs. I am able to reproduce it with Arduino CLI 0.18.0, but not with the latest build (I believe it was fixed by #1523):

$ ./arduino-cli version
arduino-cli.exe  Version: nightly-20220325 Commit: b86e5cf Date: 2022-03-25T01:33:19Z

$ ./arduino-cli.exe compile --format json --fqbn arduino:avr:mega:cpu=atmega2560 Test
{
  "compiler_out": "",
  "compiler_err": "E:\\arduino\\cli\\arduino-cli_nightly\\Test\\Test.ino:1:10: fatal error: Dummy.h: No such file or directory\r\n #include \"Dummy.h\"\r\n          ^~~~~~~~~\r\ncompilation terminated.\r\n\n",
  "builder_result": {
    "build_path": "C:\\Users\\per\\AppData\\Local\\Temp\\arduino-sketch-42DD0DDDB74BE3523412ACA473F339F0",
    "board_platform": {
      "id": "arduino:avr",
      "version": "1.8.5"
    },
    "build_platform": {
      "id": "arduino:avr",
      "version": "1.8.5"
    }
  },
  "success": false
}
Error during build: exit status 1

There is still that "Error during build: exit status 1", but this is an error message from Arduino CLI rather than the compiler, so I don't think it really belongs in the compiler_err field. It is printed to stderr, so should not pose any problems for machine parsing of the JSON output from stdout.

@per1234 per1234 closed this as completed Mar 25, 2022
@per1234 per1234 self-assigned this Mar 25, 2022
@per1234 per1234 added conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants