Go Down

Topic: collect2.exe: error: ld returned 5 exit status (Read 126705 times) previous topic - next topic

Shpaget

So, I seem to be the newest sufferer of this bug :(
I had 1.6.12 installed and it worked just fine, but today I tried to install Sublime Text (following these instructions) and the Arduino package for it. It wasn't going smoothly so I tried uploading the blink sketch to an Arduino Uno through the Arduino IDE and it worked just fine, but a few minutes later I realized that there was the 1.8.2 available so I dowloaded it.
I can no longer compile anything, even an empty sketch (Bare Minimum).
Uninstalled Sublime Text and Arduino IDE and reinstalled Arduino 1.8.2.  - no luck.
Running on Win10.
Verbose output:
Code: [Select]
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Domagoj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Domagoj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Domagoj\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10802 -build-path C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230 -warnings=all -build-cache C:\Users\Domagoj\AppData\Local\Temp\arduino_cache_470293 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\BareMinimum\BareMinimum.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Domagoj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Domagoj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Domagoj\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10802 -build-path C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230 -warnings=all -build-cache C:\Users\Domagoj\AppData\Local\Temp\arduino_cache_470293 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\BareMinimum\BareMinimum.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\sketch\BareMinimum.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\sketch\BareMinimum.ino.cpp" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\sketch\BareMinimum.ino.cpp" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\sketch\BareMinimum.ino.cpp.o"
Compiling libraries...
Compiling core...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -x assembler-with-cpp -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.S" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\core\wiring_pulse.S.o"
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -Wall -Wextra -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\WInterrupts.c" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_275230\core\WInterrupts.c.o"
cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.

exit status 1
Error compiling for board Arduino/Genuino Uno.


Again uninstalled 1.8.2 and reinstalled 1.6.12 and 1.6.11, no luck.
Tried to overwrite avr folder with this: https://forum.arduino.cc/index.php?topic=432925.0
No luck.
Tried the Windows App thing, which is 1.8.2 and it works.
At the moment I'm covered, but, I'm thoroughly confused. 

pert

So you encountered the bug with the standard IDE on Windows 10? That's very strange. We have only seen it with the standard IDE and Windows XP or the older Windows App version of the IDE on Windows 10. I do notice that your output shows you were using an old version of Arduino AVR Boards, which didn't have the fix so you might have been able to fix it by updating to the latest version of Arduino AVR boards with Boards Manager.

Shpaget

Yes, standard IDE and Windows 10.
Wouldn't reinstalling IDE fix whatever the issue was with Boards Manager?
I could be wrong, of course, but my suspicion lies with the Sublime Text. Wouldn't it meddle with Arduino files?
Anyway, I now installed 1.8.2 again and it doesn't compile, but Windows App still works just fine at the same time.
Code: [Select]
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Domagoj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Domagoj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Domagoj\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10802 -build-path C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872 -warnings=all -build-cache C:\Users\Domagoj\AppData\Local\Temp\arduino_cache_724338 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Domagoj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Domagoj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Domagoj\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10802 -build-path C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872 -warnings=all -build-cache C:\Users\Domagoj\AppData\Local\Temp\arduino_cache_724338 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\sketch\Blink.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\sketch\Blink.ino.cpp" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\sketch\Blink.ino.cpp" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\sketch\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -x assembler-with-cpp -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.S" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\core\wiring_pulse.S.o"
"C:\Users\Domagoj\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -Wall -Wextra -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\WInterrupts.c" -o "C:\Users\Domagoj\AppData\Local\Temp\arduino_build_21872\core\WInterrupts.c.o"
cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.

exit status 1
Error compiling for board Arduino/Genuino Uno.


So, following your suggestion I updated AVR Boards with Boards Manager and it compiles (and uploads) perfectly fine.
Verbose output of the sucessful compile and upload doesn't fit in this post, but if you need it just say so and I'll post it.
Thank you. I would not have solved it by myself.

pert

Wouldn't reinstalling IDE fix whatever the issue was with Boards Manager?
When you install or update a hardware package using Boards Manager it's installed to a separate location from the Arduino IDE installation folder (C:\Users\Domagoj\AppData\Local\Arduino15\packages on your system). When you update to a new IDE version the hardware packages remain installed in the Arduino15 folder and those are used. The IDE is supposed to display a message that you're using an outdated version but maybe that only happens if you have the check for updates enabled in preferences.

I could be wrong, of course, but my suspicion lies with the Sublime Text. Wouldn't it meddle with Arduino files?
It looks like it does install hardware packages to C:\Users\Domagoj\AppData\Local\Arduino15\packages so that very well could have been the source of the outdated version of Arduino AVR Boards. I don't have any experience working with that plugin.

So, following your suggestion I updated AVR Boards with Boards Manager and it compiles (and uploads) perfectly fine.
Verbose output of the sucessful compile and upload doesn't fit in this post, but if you need it just say so and I'll post it.
Sounds like the problem was solved and my suspicions were correct. Glad to hear it's working for you again. Enjoy!

vadimEL

This solve the problem.

http://cdn1.savepice.ru/uploads/2017/6/3/f32620c2b85885c1dcdaf7346852001a-full.jpg

pert

This solve the problem.

http://cdn1.savepice.ru/uploads/2017/6/3/f32620c2b85885c1dcdaf7346852001a-full.jpg

If you install Arduino IDE 1.8.2 the bug should be fixed.



wrybread

Aha, for me this was fixed by deleting the old version of the SoftwareSerial library in C:\Program Files\Arduino\hardware\arduino\avr\libraries

blewtobits

Had similar error ... "Id returned 1 exit status".
I had inadvertently deleted the setup routine (Doh!).

Cly7

It's solved since 2016: some ld.exe work in some case some board some code and not in other !
So the way is to keep all ld.exe version: each one is precious in his own "STATE"
In CASE OF BUG : CHANGE the ld.exe version try it one will work properly.
in a other "STATE" (change of ONE line of code (yes!) if it doesn't work: change again the ld.exe
Here's an old post with detailed description:

https://youtu.be/QUGvKzTXOLo will show how to use and download the new ld.exe
https://www.dropbox.com/s/llt7euhyyyxpq3i/ld.exe?dl=0 ( or find in your own directory all the ld.exe that you have saved)
place it in C:\Program Files\arduino-1.6.7\hardware\tools\avr\avr\bin
BUT BE CAREFULL DON'T GET RIDE OF FIRST ld.exe
the new ld.exe can also be bad (AND ALSO GOOD) the same way!
and then the original ld.exe works well!!!

So I have writen a swap.bat and place it in my "desk" and each time you have a problem with ld.exe: just swap them all

swap.bat (use wordpad to edit swap.txt and then rename it swap.bat)
"
copy ld.exe tempo_ld.exe
copy old_ld.exe ld.exe
copy tempo_ld.exe old_ld.exe

"
each time you have a problem with ld.exe: just swap them all and compile again: it works!
Before first swap you must put the two ld.exe (and old_ld.exe and swap.bat in the original directory where is ld.exe

Go Up