C++config.h:511:10: fatal error: bits\cpu_defines.h: No such file or directory

Hi,

I have bought an Arduino Nano ESP32. I unpacked the IDE 1.8.19.zip, created a portable folder and installed the ESP32 board package. So far everything is standard.

I compile an empty sketch and get

In file included from c:\arduino ide portable\nanoesp32\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\include\c++\8.4.0\cstdlib:41,
                 from c:\arduino ide portable\nanoesp32\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\include\c++\8.4.0\stdlib.h:36,
                 from C:\Arduino IDE Portable\NanoESP32\arduino-1.8.19\portable\packages\arduino\hardware\esp32\2.0.13/tools/sdk/esp32s3/include/newlib/platform_include/assert.h:21,
                 from c:\arduino ide portable\nanoesp32\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\sys-include\sys\reent.h:503,
                 from C:\Arduino IDE Portable\NanoESP32\arduino-1.8.19\portable\packages\arduino\hardware\esp32\2.0.13/tools/sdk/esp32s3/include/newlib/platform_include/sys/reent.h:17,
                 from c:\arduino ide portable\nanoesp32\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\sys-include\stdio.h:60,
                 from C:\Arduino IDE Portable\NanoESP32\arduino-1.8.19\portable\packages\arduino\hardware\esp32\2.0.13\cores\esp32/Arduino.h:27,
                 from sketch\sketch_dec07a.ino.cpp:1:
c:\arduino ide portable\nanoesp32\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\include\c++\8.4.0\xtensa-esp32s3-elf\no-rtti\bits\c++config.h:511:10: fatal error: bits\cpu_defines.h: No such file or directory
 #include <bits\cpu_defines.h>

The file c++config.h exists,
the entry include in line 511 is also correct,
the file cpu_define.h also exists under bits.
Both files are in the same bits folder.

What is going on here? All previous threads on this topic do not help.
OS is Windows 11.
Can anyone give me a hint?

Hi @Doc_Arduino. I'm going to ask you to post the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences...(or Arduino > Preferences... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  3. Click the "OK" button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. After the compilation fails you'll see a button on the right side of the orange bar in Arduino IDE: Copy error messages. Click that button.
    This copies the full output to the clipboard.
  6. Open a forum reply here by clicking the "Reply" button.
  7. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code tags icon on toolbar
  8. Press Ctrl+V (Command+V for macOS users).
    This will paste the compilation output into the code block.
  9. Move the cursor outside of the code tags before you add any additional text to your reply.
  10. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (image) on the post composer toolbar:
    Upload icon on toolbar
    A dialog will open.
  6. In the dialog, select the .txt file you saved.
  7. Click the "Open" button.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Hi,

NanoESP32 Compilation.txt (43,4 KB)

Edit:
With Manjaro and IDE 2.2.1 an empty sketch and also Example BlinkRGB compiles.
The above c++config.h problem is therefore specific to Windows.

If you disregard the warning. :wink:
esp32-hal-uart-c9-warning-return-with-no-value

Hi,

It is the same error with the Espressif Core.

... c++config.h:511:10: fatal error: bits\cpu_defines.h: No such file or directory
 #include <bits\cpu_defines.h>

Hello @Doc_Arduino and thanks for your informative tests. Can you please verify if this issue persists with IDE 2.x in your Windows machine?

Hi,

Everything works with Windows 10 in a VMware and IDE 2.2.1. No matter whether with Arduino ESP32 Core or Espressif ESP32 Core. Only the already reported warning appears. I ask you very kindly that you can still fix this for the IDE 1.8.19. The 1.8.19 still has the advantage that it works really portable.

Only the already reported warning appears.

C:\Users\vmware\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32\esp32-hal-uart.c: In function 'uartSetPins':
C:\Users\vmware\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32\esp32-hal-uart.c:153:9: warning: 'return' with no value, in function returning non-void
         return;
         ^~~~~~
C:\Users\vmware\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32\esp32-hal-uart.c:149:6: note: declared here
 bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
      ^~~~~~~~~~~

I tried to replicate the error by compiling for the Nano ESP32 using Arduino IDE 1.8.19 in portable mode, but it works fine for me.

I took a close look at your output, carefully comparing it against the output produced when I compile. The only interesting thing I saw was that near the end of line 19 of your output is this path:

"sketch\\sketch_dec09a.ino.cpp"

I would have expected this to be:

"C:\\Users\\Worker\\AppData\\Local\\Temp\\arduino_build_627051\\sketch\\sketch_dec09a.ino.cpp"

and in my output it is the equivalent of that second path.

I don't see how that problem would directly cause the error you are experiencing, but it might be another symptom of the common cause of both. Have you made any modifications to the file at this path?:

C:\Arduino IDE Portable\NanoESP32\arduino-1.8.19\portable\preferences.txt

Hi,

I have not changed anything in the IDE. I'll download the 18.19.zip again and try everything again. See you in a few minutes ...

Hi,

Unfortunately the same problem.
v1.8.19.zip unzipped,
portable folder created,
first start of IDE,
install Nano ESP32 Board Package,
compiled empty sketch,
error

NanoESP32 new Compilation Win11.txt (43,4 KB)

I then copied the freshly created folder from my Windows 11 to my VMware Windows 10. Same error. I have no idea what the problem could be here.

NanoESP32 new Compilation Win10 VMware.txt (43,7 KB)

There was a report of a similar error in the "esp32" boards platform issue tracker:

The workaround reported by that user was to copy cpu_defines.h to another folder that is in the the compiler's "search path". The paths are a bit different in their case, but perhaps you can adapt the workaround to your system. Obviously this should not be necessary since surely many people (including myself) are using the ESP32 boards platforms in Arduino IDE 1.8.19 without having to do such hackery, but evidently there is something unusual about your system.

The Arduino IDE 1.x project is no longer under active development.

You can find a way to configure your system to work with the IDE as is, make your own patch to the free open source Arduino IDE 1.x codebase, or use Arduino IDE 2.x with the ESP32 platforms.

Hi,

Many thanks for this idea and link. :+1:
I have started to copy the cpu_defines.h.
Then the error came because of another missing file from the same folder.
I copied it. Again error because of another missing file from the same folder. etc.
In the end I have all files

from

\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\include\c++\8.4.0\xtensa-esp32s3-elf\no-rtti\bits

to

\arduino-1.8.19\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\include\c++\8.4.0\bits

copied.

Now the sketch compiles. This is completely crazy. :wink:

Hi,

The secret of the problem has now been discovered.
Another user had an idea with the path length.
This is exactly the problem.
After unpacking you have the folder "arduino-1.8.19".

This length still works:

C:\Arduino IDE Portab\NanoESP32\arduino-1.8.19

With one character longer in front of it, it is over. Spaces are no problem.

Your ESP Core Package folder depth is too large. :wink:

I'm glad you were able to find the cause of the problem. Thanks for taking the time to post an update with your solution.

NOT SOLVED

It doesn't help that appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s2-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s2-elf\include\c++\12.2.0\xtensa-esp32s2-elf\no-rtti\bits\c++config.h
includes "bits/cpu_defines.h"
which is not in the non-existant directory "bits" under "no-rtti\bits"
but in the same directory as c++config.h

[Its almost as if another bits/cpu_defines.h was to be relied on but thats what you get for changing the partition scheme to FatFs]

Hi,

the message with the defines not found is only the error message. The cause is path length to the IDE. This should not be too deeply nested if you are using Portable 1.8.19.

The path:
appdata\local\arduino15\packages\esp32\tools\...
is standard, it has nothing to do with the installation path of the IDE.

simple problem recreation-(file reference is 200 characters long, long file names are enabled in windows, no longfilenameaware in arduino manifest):

copy c:\users\man.windows-1234567\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s2-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s2-elf\include\c++\12.2.0\xtensa-esp32s2-elf\no-rtti\bits\cpu_defines.h .\bits\cpu_defines.h The system cannot find the file specified.

Long paths with spaces require quotation marks - Windows Server | Microsoft Learn

Long filenames or filenames with special characters require double quotes

r>copy "c:\users\man.windows-1234567\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s2-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s2-elf\include\c++\12.2.0\xtensa-esp32s2-elf\no-rtti\bits\cpu_defines.h" .\bits\cpu_defines.h

    **1 file(s) copied.**

possible that backslash character is being mis-interpreted

New Windows 10 Update: pluses (+) are now considered special characters particularly if the file reference length is over 200 and have to have double quotes to reference them.