arduino / Arduino

Arduino IDE 1.x
https://www.arduino.cc/en/software
Other
14.11k stars 7k forks source link

Doesn´t compile after minor change #8324

Closed ottocarv closed 5 years ago

ottocarv commented 5 years ago

Using ArduinoIDE 1.8.8 (Windows Store 1.8.19.0)

I have built an LCD clock with Arduino Nano and ESP-01 that maintains itself right on time by asking a date and time service site on the Internet. The code compiled OK yesterday (the actual prototype is still running flawlessly) and then today I decided to change the update interval from 6 to 4 hours. I´ve changed ONE SINGLE NUMBER from the code and then it compiles no more, not even if I change the number back to what it was. This is the second time this issue occurs; in the first time I had to revamp the code to make it smaller, then it worked again. This time it´s diferent: I´ve made no substantial change, just a single number from 4 to 6. Here is what I´ve got from the compiler output window:

Linking everything together... "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567/NanoClock_V3.ino.elf" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\sketch\NanoClock_V3.ino.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SPFD5408\SPFD5408_Adafruit_GFX.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SPFD5408\SPFD5408_Adafruit_TFTLCD.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SPFD5408\SPFD5408_TouchScreen.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SPFD5408\glcdfont.c.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SD\File.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SD\SD.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SD\utility\Sd2Card.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SD\utility\SdFile.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SD\utility\SdVolume.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SoftwareSerial\SoftwareSerial.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567\libraries\SPI\SPI.cpp.o" "C:\Users\ottof\AppData\Local\Temp\arduino_build_393567/..\arduino_cache_517380\core\core_arduino_avr_nano_cpu_atmega328old_1465f6d64018740f7e766831526df7ff.a" "-LC:\Users\ottof\AppData\Local\Temp\arduino_build_393567" -lm In function 'global constructors keyed to 65535_0_NanoClock_V3.ino.cpp.o':

lto1.exe: internal compiler error: Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See http://gcc.gnu.org/bugs.html for instructions.

lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files/windowsapps/arduinollc.arduinoide_1.8.19.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

The changed section of the code is: if (!(hours % 6) && isConnected() && doUpd) { defTime(); doUpd = false; } else doUpd = true;

Just changed 6 to 4 on the line above. What kind of error is this and what is causing it? Thank you.

per1234 commented 5 years ago

Closing as duplicate of https://github.com/arduino/Arduino/issues/7949

The workaround for this issue is to roll back to Arduino AVR Boards 1.6.21:

  1. Tools > Board > Boards Manager
  2. Wait for the downloads to finish.
  3. Click on "Arduino AVR Boards".
  4. Select "1.6.21" from the dropdown version menu.
  5. Click "Install".
  6. Wait for the installation to finish.
  7. Click "Close".

After doing that, you will need to refrain from updating back to the newer versions of Arduino AVR Boards, otherwise the problem will come back. The problem should be fixed in the next release of Arduino AVR Boards (probably 1.6.24) so you should update once that is released to make sure you will benefit from ongoing development work.

There is a new AVR toolchain currently in beta testing, which is supposed to fix this problem. As an alternative to the above workaround, you can install the beta:

  1. File > Preferences
  2. In the "Additional Boards Manager URLs" field, add: http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json
  3. Click "OK".
  4. Tools > Board > Boards Manager
  5. Wait for the downloads to finish.
  6. Click on "Arduino AVR Boards".
  7. Click "Update".
  8. Wait for the installation to finish.
  9. Click "Close".
ImpulseAdventure commented 5 years ago

Hi @per1234 -- FYI, when I had attempted to test the AVR 7.3.0 package, I had found that simply adding the package to the Additional Boards Manager did not work (it only appeared to download the file to the \Users\...\AppData\Local\Arduino15 folder) with no new AVR Boards options available. Instead, I had to manually replace the package_index_bundled.json in the installation's \Arduino\hardware\ folder.