Hi @MianQi . you have the FQBN of your ESP32 board wrong in the -b flag of your arduino-cli compile command.
You can learn the correct FQBN of each of the boards you have installed by running this command:
arduino-cli board listall
You can also search for a specific board with the arduino-cli board search command.
Even though it is expected for the command to fail when you use an incorrect FQBN, it is not intended for Arduino CLI to output this cryptic stack dump. That user unfriendly output was caused by a bug, which was fixed last week:
arduino:master ← arduino:scerza/fix-compile-panic
opened 02:51PM - 28 Jan 22 UTC
**Please check if the PR fulfills these requirements**
- [x] The PR has no du… plicates (please search among the [Pull Requests](https://github.com/arduino/arduino-cli/pulls)
before creating one)
- [x] The PR follows
[our contributing guidelines](https://arduino.github.io/arduino-cli/latest/CONTRIBUTING/#pull-requests)
- [x Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] `UPGRADING.md` has been updated with a migration guide (for breaking changes)
* **What kind of change does this PR introduce?**
Fixes a panic on `compile`.
- **What is the current behavior?**
```
$ arduino-cli compile -b aduino:avr:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x10128f424]
goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1016a14a0, 0x1400003c0c8, 0x140001c5c58, 0x10168e3a8, 0x14000010018, 0x10168e3a8, 0x14000010020, 0x14000412d00, 0x0, 0x0, ...)
/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x140003faf00, 0x140004124e0, 0x1, 0x3)
/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x140003faf00, 0x140004124b0, 0x3, 0x3, 0x140003faf00, 0x140004124b0)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x14000301680, 0x1, 0x1, 0x0)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
/Users/alien/workspace/arduino-cli/main.go:31 +0xd4
```
```
$ arduino-cli compile -b arduino:av:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x1032df424]
goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1036f14a0, 0x140001a4008, 0x1400009bc58, 0x1036de3a8, 0x140001b0008, 0x1036de3a8, 0x140001b0010, 0x1400043cd00, 0x0, 0x0, ...)
/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x14000426f00, 0x1400043c4e0, 0x1, 0x3)
/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x14000426f00, 0x1400043c4b0, 0x3, 0x3, 0x14000426f00, 0x1400043c4b0)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x1400032d680, 0x1, 0x1, 0x0)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
/Users/alien/workspace/arduino-cli/main.go:31 +0xd4
```
* **What is the new behavior?**
```
$ arduino-cli compile -b aduino:avr:uno ~/Documents/Arduino/Blink/
Error during build: Platform 'arduino:vr' not found: platform not installed
```
```
$ arduino-cli compile -b arduino:av:uno ~/Documents/Arduino/Blink/
Error during build: Platform 'arduino:av' not found: platform not installed
```
- **Does this PR introduce a breaking change, and is
[titled accordingly](https://arduino.github.io/arduino-cli/latest/CONTRIBUTING/#breaking)?**
Nope.
* **Other information**:
Fixes #1531.
---
See [how to contribute](https://arduino.github.io/arduino-cli/latest/CONTRIBUTING/)
There hasn't been a new release of Arduino CLI since that fix, so the ugly output still occurs when using Arduino CLI 0.20.2, but the fix will be in the next release.
But the bug is only cosmetic and you won't encounter it once you use the correct FQBN.