Skip to content
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

The order of the compiler errors are indeterministic #1760

Open
3 tasks done
kittaakos opened this issue Jun 14, 2022 · 3 comments
Open
3 tasks done

The order of the compiler errors are indeterministic #1760

kittaakos opened this issue Jun 14, 2022 · 3 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

Describe the problem

If I have a sketch with compiler errors, as a user of the CLI, I would expect the order of the errors is deterministic. It does not.

To reproduce

Errors.zip

  • Download and extract the attached Errors.zip sketch somewhere. 👆
  • Compile with the CLI:
% ~/Downloads/arduino-cli compile -b arduino:mbed_nano:nanorp2040connect ~/Documents/Arduino/Errors
In file included from /Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp:1:0:
/Users/a.kitta/Documents/Arduino/Errors/HTab.h:1:1: error: 'bazerror' does not name a type
 bazerror;
 ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp: In function 'void qux()':
/Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp:3:3: error: 'quxerror' was not declared in this scope
   quxerror
   ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/CTab.c: In function 'pluto':
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
In file included from /Users/a.kitta/Documents/Arduino/Errors/Errors.ino:1:0:
/Users/a.kitta/Documents/Arduino/Errors/src/HFile.h:1:1: error: 'paperinoerror' does not name a type
 paperinoerror;
 ^~~~~~~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:3:3: error: 'fooerror' was not declared in this scope
   fooerror
   ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:3:3: note: suggested alternative: 'ferror'
   fooerror
   ^~~~~~~~
   ferror
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino: In function 'void loop()':
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:6:3: error: 'barerror' was not declared in this scope
   barerror
   ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:6:3: note: suggested alternative: 'strerror'
   barerror
   ^~~~~~~~
   strerror
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino: In function 'void pippo()':
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino:2:3: error: 'pippoerror' was not declared in this scope
   pippoerror
   ^~~~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino:2:3: note: suggested alternative: 'perror'
   pippoerror
   ^~~~~~~~~~
   perror



Used platform     Version Path                                                                      
arduino:mbed_nano 3.1.1   /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/3.1.1

Error during build: exit status 1
  • Without doing anything, repeat the previous step:
% ~/Downloads/arduino-cli compile -b arduino:mbed_nano:nanorp2040connect ~/Documents/Arduino/Errors
/Users/a.kitta/Documents/Arduino/Errors/CTab.c: In function 'pluto':
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
/Users/a.kitta/Documents/Arduino/Errors/CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
In file included from /Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp:1:0:
/Users/a.kitta/Documents/Arduino/Errors/HTab.h:1:1: error: 'bazerror' does not name a type
 bazerror;
 ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp: In function 'void qux()':
/Users/a.kitta/Documents/Arduino/Errors/CppTab.cpp:3:3: error: 'quxerror' was not declared in this scope
   quxerror
   ^~~~~~~~
In file included from /Users/a.kitta/Documents/Arduino/Errors/Errors.ino:1:0:
/Users/a.kitta/Documents/Arduino/Errors/src/HFile.h:1:1: error: 'paperinoerror' does not name a type
 paperinoerror;
 ^~~~~~~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:3:3: error: 'fooerror' was not declared in this scope
   fooerror
   ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:3:3: note: suggested alternative: 'ferror'
   fooerror
   ^~~~~~~~
   ferror
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino: In function 'void loop()':
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:6:3: error: 'barerror' was not declared in this scope
   barerror
   ^~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/Errors.ino:6:3: note: suggested alternative: 'strerror'
   barerror
   ^~~~~~~~
   strerror
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino: In function 'void pippo()':
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino:2:3: error: 'pippoerror' was not declared in this scope
   pippoerror
   ^~~~~~~~~~
/Users/a.kitta/Documents/Arduino/Errors/InoTab.ino:2:3: note: suggested alternative: 'perror'
   pippoerror
   ^~~~~~~~~~
   perror



Used platform     Version Path                                                                      
arduino:mbed_nano 3.1.1   /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/3.1.1

Error during build: exit status 1

First error with the first compile command:

/Users/a.kitta/Documents/Arduino/Errors/HTab.h:1:1: error: 'bazerror' does not name a type

First error with the second compile attempt:

/Users/a.kitta/Documents/Arduino/Errors/CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?

Expected behavior

No matter how many times I compile the same broken sketch, the output on the stderr is the same.

Arduino CLI version

Version: nightly-20220614 Commit: 76fab32 Date: 2022-06-14T08:23:46Z

Operating system

macOS

Operating system version

12.3.1

Additional context

No response

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
@kittaakos kittaakos added the type: imperfection Perceived defect in any part of project label Jun 14, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label Jun 14, 2022
@umbynos
Copy link
Contributor

umbynos commented Feb 7, 2023

Hi @kittaakos, unfortunately this is not a bug. The compiler is run concurrently depending on how many CPUs you have. In this case, two parallel compilations fail at the same time (CTab.c and CppTab.cpp). We do not have control on the output of the compiler.

@kittaakos
Copy link
Contributor Author

Using the same attached sketch, I ran 20 consecutive verify with the same core for the same board. The order of the compiler errors was always the same. I did the compilation on the same machine. What is the difference?

Click to see the output of the 20 Verify with Arduino Nano RP 2040 Connect with Arduino IDE 1.8.19

Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano RP2040 Connect"











/Users/a.kitta/Desktop/Errors/CTab.c: In function 'pluto':
CTab.c:2:3: error: 'plutoerror' undeclared (first use in this function); did you mean 'pluto'?
   plutoerror
   ^~~~~~~~~~
   pluto
/Users/a.kitta/Desktop/Errors/CTab.c:2:3: note: each undeclared identifier is reported only once for each function it appears in
CTab.c:3:1: error: expected ';' before '}' token
 }
 ^
exit status 1
'plutoerror' undeclared (first use in this function); did you mean 'pluto'?


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thanks!

@cmaglie
Copy link
Member

cmaglie commented Mar 17, 2023

Ensure that you have a syntax error in CTab.c and another syntax error in CppTab.cpp.

Since those two files should be compiled in parallel the order of the compile failure is not deterministic: it may fail CTab.c first (so the errors of CTab.c will be displayed first) or it may fail CppTab.cpp first (so the errors of CppTab.cpp are displayed first).

Anyway, it may be just difficult to reproduce...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

4 participants