Go Down

Topic: collect2.exe: error: ld returned 5 exit status (Read 144019 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.


pert


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

chupo_cro

#146
Aug 16, 2019, 03:58 pm Last Edit: Oct 16, 2019, 04:12 pm by chupo_cro Reason: Found solution.
I know the topic is old but the problem is too.

Here is the code that fails with:


Code: [Select]
HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':
(.text+0x0): multiple definition of `__vector_19'

collect2.exe: error: ld returned 1 exit status


when the targets are Arduino Mega2560, Arduino Pro or Arduino Nano. The code is MultiWii_1.7 that can be found here. It is an (very) old version of multicopter flight controller firmware upon which were later developed Baseflight, Cleanflight, Betaflight etc. The code is just one .pde file and there is only one include (EEPROM.h). There are multiple warnings but the error remains even after resolving all warnings except for unused vars.

I tested the code with Arduino 1.8.5 and 1.8.9 (portable) on both Windows 10 and Windows XP.

Interesting, the compile works well when the target is Arduino Mega2560 but #define MEGA
is commented out (and #define PROMINI is uncommented)!?

Any idea how that code could be compiled and/or what is the cause of the problem?

EDIT:
The problem with the code I mentioned was it was written before Arduino 1.0 when Serial() still didn't use interrupt so interrupt handler could (and it was) be used by a program. This was the point in time when that code stopped working and the new version had to be made to work with Arduino 1.0
Chupo_cro

BlondieSL

So here we are in Oct2019 and this bug is still alive and well.

I get this now and then and MOSTLY when I'm using a NANO.

Usually, I just have to Verify/Compile 2, 3, 4 times and it usually works.
Today, that did not work.
But I noticed that the editor was laggy.
I recognized this as it's trying to update libraries in the background.

So I exited the editor.
Went back in and went into Manage Libraries.
Sure enough, there were a bunch auto updating, but some that I needed to manually update.

As expected, THEN the bug went away.
I was able to upload my sketch to the NANO.
I should mention, that on this project, I spent all day yesterday working on it and only got this bug 2 or 3 times and again, just compiling 2-4 times got passed it.

It seems as if perhaps PART of what triggers this bug, MIGHT be that the editor is reaching out and trying to update libraries.... and/or IS in the process of updating, which, could lead to this error if that file or files is/are locked at the moment of updating.

Perhaps something for the devs to look into.

One way to test and maybe confirm this, is instead of the editor updating the libraries, that it allows us to update as needed.

I just now noticed 2 things as I went into preferences to see if there's an option to stop the library updates.
The only updates option is "Check for updates on startup."
I believe that is for the editor itself, but perhaps it's also for libraries.
I've unchecked that to test.

BUT, a couple of days ago, I did go into preferences and
UNCHECKED "Save when verifying or uploading."

I did that because I wanted to save when I chose, not a force save.
So now, it was checked off again!
Somehow, the editor perhaps didn't save the prefs. ???


chupo_cro

#148
Oct 16, 2019, 03:54 pm Last Edit: Oct 16, 2019, 04:08 pm by chupo_cro Reason: Visual editor made broken links so I had to use the source view to correct them.
So here we are in Oct2019 and this bug is still alive and well.

I get this now and then and MOSTLY when I'm using a NANO.

<snip>
Is your code using interrupt handlers?

The problem with the code I mentioned was it was written before Arduino 1.0 when Serial() still didn't use interrupt so interrupt handler could (and it was) be used by a program. This was the point in time when that code stopped working and the new version had to be made to work with Arduino 1.0
Chupo_cro

Go Up