Will not compile with 2.3.6 Win11

avr-g++: error: C:\Users\??????????\AppData\Local\arduino\sketches\F4D60691C359A763F311F93631EF76D7\sketch\sketch_jun7a.ino.cpp: Invalid argument
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

I never had this problem until I downloaded and use the newest version while running Win11. The code is very simple and I noticed the OUTPUT and HIGH did not highlight as before in the line of code. I am using generic UNO and NANO boards. Any help will be greatly appreciated

Please post an example of a sketch that will not compile, using code tags when you do

Hi @bptrav11. This error is caused by a bug/deficiency in GCC (avr-g++ is a part of avr-gcc, which is a variant of GCC for the AVR microcontrollers):

In this specific case, it appears your Windows user name contains post-ASCII characters.

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.

The most simple workaround will be to configure Arduino IDE to not use paths that contain problematic characters. I'll provide instructions you can follow to do that:

  1. Select File > Quit from the Arduino IDE menus if it is running.
    All IDE windows will close.
  2. Open the file at the following path in any text editor:
    C:\Users\<username>\.arduinoIDE\arduino-cli.yaml
    
    (where <username> is your Windows username)
  3. 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>
    
  4. 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.
    • :red_exclamation_mark: The path should only contain basic letters, numbers, and other simple characters (A-z, 0-9, -, _, .).
    • :warning: 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.
  5. 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.
    :red_exclamation_mark: The path should only contain basic letters, numbers, and other simple characters (A-z, 0-9, -, _, .).
  6. 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.
    :red_exclamation_mark: The path should only contain basic letters, numbers, and other simple characters (A-z, 0-9, -, _, .).
  7. 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).
    :red_exclamation_mark: The path should only contain basic letters, numbers, and other simple characters (A-z, 0-9, -, _, .).
    β“˜ 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.
  8. Save the file.
  9. Move the files from this folder on your hard drive:
    C:\Users\<username>\AppData\Local\Arduino15\libraries
    
    (where <username> is your Windows username)
    to the folder you configured in step (5) above ("<built-in libraries folder path>").
  10. Move the files from this folder on your hard drive:
    C:\Users\<username>\AppData\Local\Arduino15
    
    (where <username> is your Windows username)
    to the folder you configured in step (6) above ("<data folder path>").
  11. 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.
  12. Start Arduino IDE.

Now try compiling or uploading your sketch again. Hopefully this time it will be successful.

Alternative Workaround

The obvious alternative would be to change your Windows username to a name that doesn't contain problematic characters. However, this might be quite inconvenient.


I'll mention that I did find an alternative workaround that allows you to use the paths that contain non-ASCII characters, meaning you can leave the Arduino IDE configuration as-is, and also keep your current Windows username. 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:

  1. Right click the Windows "Start" button.
    A context menu will open.
  2. Select "Settings" from the menu.
    Windows Settings will open.
  3. 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.
  4. 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.
  5. Select "Administrative language settings" from the right panel of the Settings window.
    The "Region" dialog will open.
  6. Click the "Change system locale" button in the "Region" dialog.
    The "Region Settings" dialog will open.
  7. Check the checkbox next to "Beta: Use Unicode UTF-8 for worldwide language support".
  8. Click the "OK" button.
    The "Change System Local" dialog will open, notifying you that you must restart your computer before the setting change will take effect.
  9. Save any unsaved work in open applications.
  10. Click the "Restart now" button in the "Change System Local" dialog.
    Your computer will restart.

After doing that, you should be able to compile without encountering the unexpected error.

1 Like

This is a familiar experience with IDE 2.3.6 and the inexpensive NANO boards.

The older 1.8.19 compiler works fine for me and the NANO boards; however, ...

What am I doing wrong with the 2.3.6 compiler?

This is a simple code that works with 1.8.19 but not 2.3.6. NANO board photo attached.

Your comments are welcomed.

#include <Wire.h>#include "RTClib.h"RTC_DS1307 rtc;DateTime myDT;char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};byte lastReadSecond = 0;
void setup (){Serial.begin(115200);Wire.begin();
Wire.beginTransmission(0x68);byte busStatus = Wire.endTransmission();if (busStatus != 0){Serial.println("RTC is not present.");while (true);}Serial.println("RTC is present.");
rtc.begin();rtc.adjust(DateTime(F(DATE), F(TIME)));//taking current time from PC// rtc.adjust(DateTime(2021, 12, 31, 01, 59, 57));//set date-time manualy:yr,mo,dy,hr,mn,sec}
void loop (){myDT = rtc.now();if (lastReadSecond != myDT.second())//wait 1-sec as long as they are equal = 1s has not gones{showTimeDate();//1-sec has e;apsed; show time and date}}
void showTimeDate(){//update to the new secondmyDT = rtc.now();lastReadSecond = myDT.second();//------------------------------Serial.print(myDT.year(), DEC);Serial.print('/');//-----------------------------Serial.print(myDT.month(), DEC);Serial.print('/');Serial.print(myDT.day(), DEC);Serial.print(" (");Serial.print(daysOfTheWeek[myDT.dayOfTheWeek()]);Serial.print(") ");//-----------------------------byte myHour = myDT.hour();// myHour = myHour - 12;if (myHour < 10){Serial.print('0');  //show leading zero}Serial.print(myHour, DEC);Serial.print(':');//-----------------------------byte myMin = myDT.minute();if (myMin < 10){Serial.print('0');  //show leading zero}Serial.print(myMin, DEC);Serial.print(':');//--------------------------byte mySec = myDT.second();if (mySec < 10){Serial.print('0');  //show leading zero}Serial.print(mySec, DEC);//----------------------------Serial.println();}

Posted in error.

Hi @bptrav11. I'm not sure I understood correctly what you mean by " but not 2.3.6". Please provide a more detailed description of what you mean in a reply on this forum topic to help us to understand it.

Make sure to include the following information:

  • What did you do?
  • What were the results you expected from doing that thing?
  • What were the results you observed that did not match your expectations?

If you encountered any errors or warnings, please provide the full and exact text of those messages.

Thank you ptillisch for your reply and taking your time to my request for help.

I need to correct my earlier statement regarding code not compiling in Arduino IDE 2.3.6. The IDE 2.3.6 will compile the code; however, it fails to upload the program to the NANO board (pictured above). The errors I receive are:

Sketch uses 6624 bytes (21%) of program storage space. Maximum is 30720 bytes.
Global variables use 549 bytes (26%) of dynamic memory, leaving 1499 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0d
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x0a
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x42
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x4d
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x45
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x32
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x38
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x74
Failed uploading: uploading error: exit status 1

The program is supposed to set the time in a DS1307 module from the time in the computer which is taken by the computer from a national time clock service.

When I compile and upload the exact same code using the Arduino 1.8.19 program, with the exact same hardware and wiring unchanged, it all works as expected. The time is set in the DS1307 module and properly displayed in the serial monitor.

Please let me know if you would like additional information.

I'm going to ask you to provide the full verbose output from an upload attempt.


:red_exclamation_mark: 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 IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Uncheck the box next to Show verbose output during: β˜‘ compile in the "Preferences" dialog.
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the "OK" button.
    The "Preferences" dialog will close.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  8. Open a reply here on this forum topic by clicking the "Reply" button.
  9. 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.
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to publish the post.

It will take me several days to respond.

We'll be here whenever you are ready.

ptillisch:

I want to thank you for spending your time with me on this issue with Arduino IDE 2.3.6.

It helps if the right board is selected when uploading the program. I mistakenly had the incorrect board selected as I was using the IDE 2.3.6 software. When I switched boards to the Atmel atmega318p Xplained mini, it works as expected, i.e., no upload errors and the program executes as intended; for both the Arduino 1.8.19 and Arduino IDE 2.3.6.

Thank you again for your support.

You are welcome. I'm glad it is working now.

Regards, Per