Compiling for ESP32 target

I'm just migrating to the Arduino CLI and trying to build a sketch for the ESP32-CAM via CLI. Core package installed (esp32:esp32) and board attached as esp32cam or esp32wrover but I get a build error due to compilation fatal error:

c:\users\luca\...\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\utility:68:28: fatal error: bits/c++config.h: No such file or directory compilation terminated.
Error during build: exit status 1

This is probably due a missing include folder (i.e. xtensa-esp32-elf at the same location as the utility above) in the build tool.

The error can be replicated by compiling the "Examples/ESP32/Camera/CameraWebServer" in the Arduino IDE and setting the board as esp32cam esp32wrover or any ESP32 board with external PSRAM:

arduino-cli compile -n -v -b esp32:esp32:esp32cam

NOTE: Here using the dry-run flag for testing.

Trying to compile for a generic ESP32 board instead the compilation terminates successfully but using 156% of program storage. Strange behavior while using Arduino IDE the same sketch compiles without errors with and without PSRAM.

Can anyone confirm this issue?

An other more generic question. In Ardiuno IDE some target boards have compile-time options like "ESP32 Wrover Module" to change flash frequency, partition scheme, etc. Is there a way to pass this options to Arduino CLI too? Probably using the "--build-properties strings" flag but I cannot find any reference to the strings format and option names.

Looking at @schlameel 's topic (Compile with CLI and specify register emulation option) probably got response of one of my questions: How to select compile-time options. This also give me a confirmation that the problem is related to the PSRAM because compiling with:

arduino-cli compile -n -v -b esp32:esp32:esp32:PSRAM=disabled,PartitionScheme=huge_app,CPUFreq=80

terminates with no erros, while compiling with:

arduino-cli compile -n -v -b esp32:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=80

terminates with fatal error (bits/C++config.h not found).

Unfortunately I'm not able to reproduce the issue please save the full output from the failed compilation to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link that will allow you to make the attachment.

Thanks pert, probably I found the problem after reading your reply saying you can't reproduce the error. In the meantime I tried on my PC at home and the compilation succeeded. The only difference was in the path, right the path was too long I suppose. I moved the "" directly in the C: root folder and voilĂ ... Windows strikes again!

I'm glad to hear you fixed it. Thanks for taking the time to post an update with your solution!