-
-
Notifications
You must be signed in to change notification settings - Fork 7k
"ld returned 5 exit status" on Win XP #2989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do you have Cygwin installed? |
Have you tried updating the Microsoft C Run Time? |
I also tried disabling every possible software, without success. |
User f41_ardu discovered another workaround for this issue: replace original file ld.exe with the file of the same name copied from the previous IDE 1.0.6. |
I confirm this on 1.6.5. Had to downgrade to 1.6.0, seems no problem (but library is missing several useful functions, e.g EEPROM.update). |
I could suggest to create a Temp directory on C drive and then change TMP and TEMP system variable definition to C:\Temp. Linkers are generally sensitive on paths content, so it is recommanded to set simpler and shorter system paths, specially on older operating systems. 1.6.5 do not fails any more on linking after this change on Windows XP. |
Is the issue with ld known already? What exactly does error 5 mean? |
I suggest this solution because it solves the problem on my side for my Arduino projects and those of my friends under Windows XP. |
Thank you! I will try this when I encounter this bug again |
Are you living in china or why the hell are you using XP? |
It's an educational facility that does not have resources to upgrade a dozens of computers to be able to run win7. It happens. |
Actually, did anyone post this bug upstream? It seems to be a gcc/mingw/avr-gcc bug (sorry, don't know what project is directly related) |
Googling for "ld returned 5 exit status" it seems that Arduino is not the only one that is suffering this problem. BTW I only found people complaining about the bug but nobody actually investigated the issue. If someone has some insight about the real cause of the bug it would be really helpful. |
If anyone can read a procmon dump here, I can provide one. |
I've peeked in the ld sources and did not find any |
The nasty error code 5 beat me today, find a cure by adding Serial.prinln(); at the end of void loop(). Nasty error - nasty solution, but i could not leave the things that way, so I spent few hours in investigation of forum. Test the old version of ld.exe from IDE 1.05, OK, work, but didn't like it, then added some global variables, also work fine, but this is not a solution, it is just a nasty trick. Then i try to do what fabelec95 said in the comment here and it work just fine.
|
This is really weird. My sketch didnt' compile because of this sentence: velocidadTren = velocidadTren-int(velocidadMaxima/aceleracionPasos); all of them integer variables and <> zero. I tried everything, from creating a float variable to store the calculation, to adding spaces between the variables and operators, to no avail. But yes, there is a fix, weird too: I added this one in the declarations section: char myvar ='hello'; and, believe or not, it fixed it! Now it compiles. I truly hope the Arduino boys are reading this. |
this really hasn't been fixed yet? sad. |
@mralexgray are you affected by this bug? The cause of this bug is still unknown and I'm still unable to reproduce it on my (two) Windows XP boxes. All the analysis made until now makes me think about some memory corruption that happens inside "ld" and under some very particular conditions (that vary from PC to PC).
also there isn't a "common" workaround that works for everyone. What works for one user may not work for another. Moreover these are... well... workarounds and they don't give any clue on where the real bug is. So unless someone takes the time to dig into the "ld" source and debug it, I guess that this issue will last for a long time... |
I run a classroom lab with 33 Windows XP computers and do a month long Arduino unit. This year was a disaster as nearly every computer ran into this problem. I worked around it each time by adding code (a useless for loop, a String variable that does nothing, a double variable that does nothing, etc.) I am attaching two files which fail to compile on 1.6.5 and 1.6.7. The good news is that they did compile on the "nightly build" from two days ago (1.6.9 s/t). I never had problems in previous years (I update the Arduino software in August before school starts on the image I use to clone all the PCs.) It would be great if this problem could be fixed. My plan if there is no fix is to downgrade to a much older version of the IDE. I'm sorry I don't know the version that last worked perfectly, but it would be whatever version was the released version mid-August 2014. (I renamed both uploaded files to .txt but they are .ino sketches.) |
Adding six variables worked for me. (XP, IDE 1.6.7) . I'm ok with this strange workaround for this strange bug... Thanks @oldmaker ! |
@walthays do you want to became an Arduino Create Editor betatester? We are interested in supporting legacy systems and we can probably help you running the latest Arduino Editor in your lab. Please contact me at webmaster at arduino.cc |
Following 73-de-LZ commented on Nov 27, 2015 I did this and it works.
|
OK, I got a failure, source, and full dumps all zipped up. It's BIG -- 125 MB. What's the best way to pass this to some developer who will review it and pass it to GCC? Here's a .png screen print of some Windgb output. I'm not a windows internals person, but I suspect this is a bad pointer from uninitialized data (0xf0f0f0f0f). BTW, if the gnucc people could provide symbols.... |
Getting close! First, running under the debugger always causes memory to be initialized with various patterns. I suspect this will be a catastrophic collision with GCC's assumption that memory allocated from the system is always zeroed out, thus automatically full-filling the C requirement that "uninitialized" means zero. This is going to make debugging in a windows environment almost impossible. I wonder if the GCC run-time people have never done serious work under windows. Second, good news! I've gotten an exception where memory contains 0xfeeefeee, which is the value the heap manager places in storage after the heap is freed. Bad news: the failing program is now \liblto_plugin-0.dll, a LD.exe plug-in. I'm afraid this is going to be a matter of rebuilding the AVR tool chain (i.e. Gcc/G++) on my system. Why can't I find any support from the Arduino IDE people? Here's the Windgb output: Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 CommandLine: "c:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe" "-plugin" "c:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../libexec/gcc/avr/4.9.2/liblto_plugin-0.dll" "-plugin-opt=c:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../libexec/gcc/avr/4.9.2/lto-wrapper.exe" "-plugin-opt=-fresolution=C:\TMP\ccV2Ta9A.res" "-plugin-opt=-pass-through=-lgcc" "-plugin-opt=-pass-through=-lm" "-plugin-opt=-pass-through=-lc" "-plugin-opt=-pass-through=-latmega32u4" "-mavr5" "-Tdata" "0x800100" "-o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp/Ammeter.ino.elf" "c:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5/crtatmega32u4.o" "-LC:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp" "-Lc:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/avr5" "-Lc:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5" "-Lc:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2" "-Lc:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc" "-Lc:/documents and settings/jared/local settings/application data/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib" "--gc-sections" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\sketch\Ammeter.ino.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\Pins_Jared\I2Cscan.c.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\FastIO.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\I2CIO.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LCD.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_I2C.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_I2C_ByVac.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_SI2C.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_SR.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_SR1W.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_SR2W.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\LiquidCrystal_SR3W.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\NewliquidCrystal\SI2CIO.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\Wire\Wire.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\Wire\utility\twi.c.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp\libraries\SDL_Arduino_INA3221\SDL_Arduino_INA3221.cpp.o" "C:\TMP\build692751f7cbd22bc67458fdfc887a2b9c.tmp/core\core.a" "-lm" "--start-group" "-lgcc" "-lm" "-lc" "-latmega32u4" "--end-group" Symbol search path is: srv_c:\symbols_https://msdl.microsoft.com/download/symbols Executable search path is: (418.ea0): Access violation - code c0000005 (first chance) |
Hey there! Good work debugging this stuff. |
Hi @HiTechHiTouch , |
the build scripts used to create the toolchain are here: https://github.com/arduino/toolchain-avr launching |
@facchinm will work on it. You seem to be ahead of where I think I will end up going. @positron96 I'm thinking the Arduino GUI people are just copying this stuff from Atmel. I look at C:\Program Files\Arduino\hardware\tools\avr\builtin_tools_versions.txt and see |
@cmaglie Yes, MinGW seems to be the way to go. I got a precompiled 4.9.2 setup off github but haven't fired it up. My Current problem: mingw sets an environment variable (bash env) from windows environment, and strips off the drive letter from c:/mingw/bin in the PATH variable. Now I cd out to another drive where I have my sources, run scripts, and (I think) bash looks for mingw/bin on my source drive, not my c: drive. Any suggestions? Any site for mingw support, or do people just depend on stackoverflow.com ? |
@facchinm Martino, please email me. HiTechHiTouch on yahoo mail. |
uhm, I never had this problem since I have only one drive C:. I'm not really a mingw expert, but maybe it's worth trying to a have a look at the |
@cmaglie After I installed cygwin, the problem "went away". I suspect stuff that should be coming out of mingw/bin may actually be coming out of cygwin/bin. cygwin is explicit about being first in PATH, and mingw said to append to the end of PATH. I don't like running with mixed modules, i..e. GCC 4.9.1 in mingw and 5.2.0 in cygwin. But so far, no really obvious problems. PS: Tried to send you email at arduino.cc. It bounced, so please email me (see above). |
Still working, but the build process has become a real swamp of alligators. |
I had the same problem. I found that by including the "Wire" library it compiled fine. |
Compiling a simple code I have found 1.6.12 Arduino IDE version still have the issue. Windows 10. Adding or removing some functions it apperas/dissapears. |
...and changing ld.exe with the ld.exe from 1.0.5 or 1.0.6 doesnt work, because old ld.exe's cannot read 'plugin' extra commands and exits with another error. Should be easy to fix, as adding or removing a single line of code (a redundant function by example) can make it compile. |
I have: And today I even couldn't compile empty sketch like this:
The error is the same: Last line in log before error was: What helped me was to move Arduino IDE out of "c:\program files\arduino" to "c:\arduino". That's quite common trick to make older software work in Windows7 but I didn't expect that it will make new Arduino SW work in Windows XP. |
Hi, just my 5 cents of contribution. I had the same problem as everyone, Windows XP, IDE 1.6.13 and crazy compilation erros. As the error sugested something related to my board, I decided to downgrade the board specs (Tools > Board > board manager > find your board > select older version > install). I went from "Arduino AVR boards" 1.6.15 back to 1.6.2 and things started working. Didn't noticed any functionality losses or any other errors/bugs with the downgrade. Will try to go up a little to see if thigs stay working. |
+1 ...same sketch on Win7(64), IDE 1.6.13 - All is OK! |
Can someone check if the build provided here |
Hi All! I confirm that "Update bundled tools # 5863" solves this problem for me. My test environment: Windows XP SP3, CPU AMD Athlon (tm) XP 2400+, Genuino UNO. Because My CPU is AMD Athlon XP, I would be glad if in the next release the utility arduino-builder, and other utilities written on GO, would be compiled with the parameter GO386 = 387 disabling SSE2. Otherwise, I have to recompile arduino-builder from the source code myself. |
Fixed on IDE 1.8.2 (and AVR core 1.6.18). |
Two sketches of mine (only those two), compiling fine with IDE 1.0.x, cannot compile with new IDEs (on Windows XP): after the syntax check, appears a Windows error relative to ld.exe; then compilation stops with message "collect2.exe: error: ld returned 5 exit status".
Issue context:
IDE 1.6.1 or 1.6.2 or 1.6.3
O.S. Windows XP
The same sketches, with IDE 1.6.x, on another PC with Windows 8.1, compiles OK.
The same sketches, with IDE 1.0.x, compiles OK.
I discovered a (ridiculous) work-around: adding some totally useless global variables, the two sketches compiles OK also with IDE 1.6.x on Win XP:
The first sketch needs at least 3 additional global variables, the second at least 6.
It doesn't matter the name, the type or the values; the only requirement seems to be the number of variables added.
Similar issues on this site: #2768 and #2813
Verbose debug output of IDE 1.6.3, on Windows XP:
The sketch:
Windows crash messages:



The text was updated successfully, but these errors were encountered: