When compiling a sketch in Arduino IDE, the compiler attempts to access files from an incorrect or non-existent directory, leading to a compilation failure.
It appears that the compiler is referencing an incorrect directory (C:\Users\Samir Budimcic\... instead of C:\Users\Samir Budimčić\...), which may be due to an encoding issue with special characters in the username.
Arduino IDE Version: 2.3.5-nightly-20241212
OS: Windows 11 Enterprise N
FQBN: arduino:avr:bt
Using board 'bt' from platform in folder: C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_BT -DARDUINO_ARCH_AVR -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\8B3901947FC18008ED7514ED4A973BE2\sketch\sketch_feb20a.ino.cpp -o nul
Error while detecting libraries included by C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\8B3901947FC18008ED7514ED4A973BE2\sketch\sketch_feb20a.ino.cpp
Generating function prototypes...
C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_BT -DARDUINO_ARCH_AVR -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\8B3901947FC18008ED7514ED4A973BE2\sketch\sketch_feb20a.ino.cpp -o C:\tmp\2778224439\sketch_merged.cpp
avr-g++: error: C:\Users\Samir Budimcic\AppData\Local\arduino\sketches\8B3901947FC18008ED7514ED4A973BE2\sketch\sketch_feb20a.ino.cpp: No such file or directory
avr-g++: warning: '-x c++' after last input file has no effect
avr-g++: error: device-specs/specs-atmega328p: No such file or directory
exit status 1
Compilation error: exit status 1
This is a known issue with non-ascii characters in the path. Workaround can be to create a new user account without the non-ascii characters or move your sketchbook directory to a directory where the path does not contain the non-ascii characters.
See Spurious "No such file or directory" error when library's path contains post-ASCII characters · Issue #1239 · arduino/arduino-cli · GitHub
Problem persist when "Sketchbook location" is set to "c:\Sketches" in Preferences.
Are you sure it's the same error related to the non-ascii characters? Or another error?
If the former, I suspect a caching issue. You can delete the directory C:\Users\yourUsername\AppData\Local\arduino. It's safe to do so, it will be recreated the next time that you compile your sketch.
I have turned off application, deleted directory and started UI again. Directory with contents was created, but problem persists.
I will paste output below. Note that directory name on first line with avr-g++: error does not match directory name used before.
FQBN: arduino:avr:bt
Using board 'bt' from platform in folder: C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_BT -DARDUINO_ARCH_AVR -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\D9654B570C6C042B8E8A7F3439C0C041\sketch\automat.ino.cpp -o nul
Error while detecting libraries included by C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\D9654B570C6C042B8E8A7F3439C0C041\sketch\automat.ino.cpp
Generating function prototypes...
C:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_BT -DARDUINO_ARCH_AVR -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Samir Budimčić\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\Samir Budimčić\AppData\Local\arduino\sketches\D9654B570C6C042B8E8A7F3439C0C041\sketch\automat.ino.cpp -o C:\tmp\27831208\sketch_merged.cpp
avr-g++: error: C:\Users\Samir Budimcic\AppData\Local\arduino\sketches\D9654B570C6C042B8E8A7F3439C0C041\sketch\automat.ino.cpp: No such file or directory
avr-g++: warning: '-x c++' after last input file has no effect
avr-g++: error: device-specs/specs-atmega328p: No such file or directory
exit status 1
Compilation error: exit status 1
Same error happens if i call avr-g++ manually, passing only filename as parameter. Perhaps avr-g++ does not handle non-ascii characters in parameters?
Is there a way to instruct IDE to use some other
directory instead of c;\Users<username>/...?
Excellent work on troubleshooting!
Yes, that is the problem. It is a bug/deficiency in GCC (avr-g++ is a part of avr-gcc, which is a variant of GCC for the AVR microcontrollers):
The bug has been fixed, but the fix is in GCC 13, while the "Arduino AVR Boards" platform and most other Arduino boards platforms are using a significantly older version of GCC which doesn't have the fix.
Yes, and I think this will be the most simple workaround. I'll provide instructions you can follow to do that:
- Select File > Quit from the Arduino IDE menus if it is running.
All IDE windows will close.
- Open the file at the following path in any text editor:
C:\Users\<username>\.arduinoIDE\arduino-cli.yaml
(where <username> is your Windows username)
- Add the following content to the
arduino-cli.yaml file (or replace the existing content if equivalent content is already present in the file):build_cache:
path: <build cache folder path>
directories:
builtin:
libraries: <built-in libraries folder path>
data: <data folder path>
user: <sketchbook folder path>
- Replace the
<build cache folder path> placeholder with the path to the folder under which you want Arduino to store the cached data for compiling sketches.
Arduino IDE periodically deletes the contents of this folder (the files stored under it are only cached there for the sake of efficiency, and it can always regenerate the files on demand), so you should not use this folder to store any valuable files.
- Replace the
<built-in libraries folder path> placeholder with the path to the folder under which you want Arduino to store some fundamental "built-in" Arduino libraries.
- Replace the
<data folder path> placeholder with the path to the folder under which you want Arduino to store the boards platforms you install via Boards Manager, as well as some other data files.
- Replace the
<sketchbook folder path> placeholder with the path you want to use as the Arduino sketchbook (the folder under Arduino IDE stores libraries you install via Library Manager and "Add .ZIP Library...", as well as a convenient location to save your sketches).
ⓘ Unlike the other paths, you can also configure this one via Arduino IDE's preferences GUI. I thought I should include it in these instructions just to be comprehensive.
- Save the file.
- Move the files from this folder on your hard drive:
C:\Users\Samir Budimčić\AppData\Local\Arduino15\libraries
to the folder you configured in step (5) above ("<built-in libraries folder path>").
- Move the files from this folder on your hard drive:
C:\Users\Samir Budimčić\AppData\Local\Arduino15
to the folder you configured in step (6) above ("<data folder path>").
- If you configured a different folder in step (7) above ("
<sketchbook folder path>"), move the files from the previous sketchbook folder location to the new one.
- Start Arduino IDE.
Now try compiling or uploading your sketch again. Hopefully this time it will be successful.
Alternative Workaround
In case it will be of use to you (or anyone else suffering from this problem who finds the forum topic while searching for a solution), I'll mention that I did find an alternative workaround that allows you to use the paths that contain non-ASCII characters. It requires changing an "experimental" Windows setting, which affects the Windows operating system and all applications, so it is possible it could affect the stability of Windows or compatibility with other applications. So it is definitely something that should be done with caution, if at all:
- Right click the Windows "Start" button.
A context menu will open.
- Select "Settings" from the menu.
Windows Settings will open.
- Select "Time & language" from the navigation panel on the left side of the Settings window.
The "Time & language" settings will open in the right panel of the window.
- Select "Language & region" from the right panel of the Settings window.
The "Time & language > Language & region" settings will open in the right panel of the window.
- Select "Administrative language settings" from the right panel of the Settings window.
The "Region" dialog will open.
- Click the "Change system locale" button in the "Region" dialog.
The "Region Settings" dialog will open.
- Check the checkbox next to "Beta: Use Unicode UTF-8 for worldwide language support".
- Click the "OK" button.
The "Change System Locale" dialog will open, notifying you that you must restart your computer before the setting change will take effect.
- Save any unsaved work in open applications.
- Click the "Restart now" button in the "Change System Locale" dialog.
Your computer will restart.
After doing that, you should be able to compile without encountering the unexpected error.
Thank you for your time and effort! Kind regards!
You are welcome. I'm glad if I was able to be of assistance.
Regards, Per