Go Down

Topic: Compiler / IDE bug /ar.exe: unable to rename 'core\core.a'; reason: File exists (Read 3308 times) previous topic - next topic

stevensarns

I have been using Arduino IDE for years and suddenly this bug started appearing:


c:\program files (x86)\arduino\hardware\tools\avr\bin\../lib/gcc/avr/4.9.2/../../../../avr/bin/ar.exe: unable to rename 'core\core.a'; reason: File exists

exit status 1
Error compiling for board Arduino Leonardo.

I am using Windows 10.

Changing to Uno does not solve the problem.

I upgraded from 1.8.3 to 1.8.5.  No change.

I re-installed Arduino IDE 1.8.5.  No change.

I stopped McAffee anti-virus.  No change.

Here is my workaround:  Click NEW (open a blank sketch with setup() and loop()), click VERIFY, close file, return to my sketch, compiles ok.

I know this bug has been reported in a separate thread, but this workaround seems to work every time.  Hopefully the new report will attract enough attention to fix the bug.  If this is not a bug, and instead it is my stupidity - sorry.

pert

Thanks for sharing your workaround! I know a similar error (unable to rename 'core\core.a'; reason: Permission denied) has been reported on the issue tracker and I think that has always ended up being the antivirus but apparently that is not the cause of the "reason: File exists" error.

markbo

I too have encountered the error and stumbled across the same workaround as stevenarns above.  My environment is Windows 10.  I completely upgraded/cleared the IDE environment to 1.8.5.  Clean install of only one extra library - MySensors version 1.2.1.  I get the error Verifying one of the MySensors examples - no code changes at all.  As stevenarns has reported, if I open a NEW sketch - basically empty - and run a Verfy, then return to my MySensors example sketch, and re-verify - all ok.

barsznica

Unfortunately, the workaround did not work for me (IDE 1.8.7, Windows 10)  :(
Running as Admin doesn't work, either :(

This solution didn't work either:
Quote
Upon disconnecting the Digispark from the USB and then re-initiating the upload process, the problem resolved itself.
I will try this solution now:
Quote
Do a full uninstall of Arduino, then delete the Arduino folder and Arduino15 (back them up first if you have any sketches in there!!!!), as well as any arduino folders under Temp. Make sure the folders and all contents are really gone, reboot and try again if not. Then, do a clean install of the IDE.
I'm curios if this has something to do with "Arduino Create Agent"?

It could have been due to using ESP8266 board def: https://github.com/esp8266/Arduino/releases/download/2.4.0-rc1/package_esp8266com_index.json
rather than: https://github.com/esp8266/Arduino/releases/download/2.4.0-rc1/package_esp8266com_index.json
Lights, music, electronics, Action!

pert

This sort of error could be caused by your antivirus software. Try TEMPORARILY disabling your antivirus for a single compilation to see if the problem goes away, then turn the antivirus back on. If the problem doesn't occur with the antivirus off you will need to adjust the settings of your antivirus to whitelist the appropriate file, folder, or process so it doesn't interfere with compilation.

barsznica

Good point, but I'm setting up from scratch now.
If it happens again, I'll try it (and report back here).

I didn't try your suggestion first, as you previously stated, "I know a similar error (unable to rename 'core\core.a'; reason: Permission denied) has been reported on the issue tracker and I think that has always ended up being the antivirus but apparently that is not the cause of the "reason: File exists" error."

BUT, the fresh install did the same thing!
Adding an exception to my Antivirus worked. THANK YOU!!!  :o  :)  :)  :)
Lights, music, electronics, Action!

pert


barsznica

Suddenly, it is happening again!  :o  :(

I'm running Avira Free...
... turning Real-Time Protection off allows IDE to work!

I turned Real-Time Protection on, but under "Files", I selected "Use smart extensions" rather than "All files". That worked.
Then, I removed all the exceptions I added previously. Still works!
Fingers crossed (makes it hard to code)!
Lights, music, electronics, Action!

pert

One potential cause of this is that the core.a file is saved to a temporary build folder. The build folder name is different every time you start the Arduino IDE. So if you whitelist the specific build folder, that will only fix the problem for the time you are using that particular instance of the Arduino IDE and the next time you start it the problem will be back because the new build folder is not on the whitelist.

tgathright

  THANKS I am using McAfee and I have excluded "Arduino exe" and the darn thing Compiled!!!! Thank you very much, I've been stressing out for over a month with this. Hope experts can straighten out the IDE so other people don't go thru this problem. I have been using Arduino for more than two years and never had this problem before. Seems you have saved the day!!!!

sterretje

It's not really a matter of straightening out the IDE.

I had issues with McAfee and MSsql Server. Do you expect Microsoft to straighten out MSSql Server?

Configuring McAfee properly by the IT department eventually sorted it out (took them 2 months).
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

tgathright

Darn, after a while the problem resurfaced, will not compile anything, at a loss for words. Re: Compiler / IDE bug /ar.exe: unable to rename 'core\core.a'; reason: File exists

ballscrewbob

To those of you who have antimalware / antivirus issues or slow compiles for sketches.

There is usually an option in those programs to whitelist / exclude files and folders.

Slow compiles under Windows and may apply to other OS if you have similar software.

Add the Arduino directories to your antivirus / anti malware / other security exclusions.

So that would be at least two of the following.

C:\Program Files (x86)\Arduino
C:\Users\yourname\AppData\Local\Arduino15      depends on IDE
C:\Users\yourname\AppData\Roaming\Arduino15   depends on IDE

If you have your sketches set up in a different location it's also worth adding that directory to the exclusions also.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

teddyz

If the above does not help (as for me), then either run arduino as an administrator or give normal users "Full control" permission to the local folder (C:\Users\yourname\AppData\Local) or the temp-folder where the failed compilation happens (C:\Users\yourname\AppData\Local\Temp).

It might be difficult to do this, you might first need to be owner of the folder. Using Windows 7, you change owner here:



Also untick Include inheritable permissions:



This will fix the symptom of not being able to compile, but not the root-cause. In my case this problem started after I rescued the Windows-installation from an Windows update-failure. I hope it might be useful to someone.

Go Up