avr-ar cannot find temp folder when run from eclipse

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Eclipse Neon (4.6.3) with CDT 9.2.1.

Arduino IDE 1.8.3 (I use it for the libraries and tool chain). This has GCC 4.9.2.

MinGW32 is installed and that has GCC 5.3.0.

 

I am trying to build an C++project from Eclipse. I am not using the Arduino add in for Eclipse. To build my project I use a makefile which I run from Eclipse. I have confirmed that Eclipse is using make from MingGW32.

 

The makefile fails on this step.

 

C:/workspace/arduino-1.8.3/hardware/tools/avr/bin/avr-ar.exe rcs --plugin C:/workspace/arduino-1.8.3/hardware/tools/avr/libexec/gcc/avr/4.9.2/liblto_plugin-0.dll core.a core/abi.cpp.o core/CDC.cpp.o core/HardwareSerial.cpp.o core/HardwareSerial0.cpp.o core/HardwareSerial1.cpp.o core/HardwareSerial2.cpp.o core/HardwareSerial3.cpp.o core/hooks.c.o core/IPAddress.cpp.o core/main.cpp.o core/new.cpp.o core/PluggableUSB.cpp.o core/Print.cpp.o core/Stream.cpp.o core/Tone.cpp.o core/USBCore.cpp.o core/WInterrupts.c.o core/wiring.c.o core/wiring_analog.c.o core/wiring_digital.c.o core/wiring_pulse.c.o core/wiring_pulse.S.o core/wiring_shift.c.o core/WMath.cpp.o core/WString.cpp.o

 

It gives the error message ...

 

c:\workspace\arduino-1.8.3\hardware\tools\avr\bin\avr-ar.exe: could not create temporary file whilst writing archive: No more archived files

 

I opened a DOS command line went to my build folder and entered the command and it worked. Also, if I start a bash shell, it still works.

 

There is nothing in the Eclipse error log.

 

I know Eclipse is setting up a bash shell to run the makefile. I have confirmed that Eclipse is using make from C:\MinGW. There are some other some other mingw's on the system, but I know Eclipse is using C:\MinGW because when I move avr-ar.exe Eclipse reports the command cannot be found.

 

Anyone have any details on how Eclipse CDT sets up a bash shell to run a makefile? I think it has got to do with the bash shell as Eclipse sets it up.

 

This topic has a solution.
Last Edited: Sun. Jul 23, 2017 - 07:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hypothesis: When Eclipse runs the makefile it is in a directory where it has no rights to create the temp file. One idea is to simply have your makefile display what the current directory is, right before the ar command. A simple pwd, perhaps?

 

Also, for the sake of experiment, does the ar command still fail if you remove all but one or two files from the recipe in the makefile?

 

Another idea is to start Eclipse as administrator. Perhaps the rights are inherited down to the process that runs Make?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pwd reports /c/workspace/BlinkingLED/build, which is the expected directory. This is the directory I was using when I ran the command from the the shell. It has the required rights in this directory.

 

I get the same failure if only one file is listed.

 

The issue still exists when I start Eclipse as administrator.

 

I made two more discoveries. First I can run the makefile itself from the command line. Second, when put "set" into the makefile, I found that the environment is markedly different when running from Eclipse than it is when running from the command line. The Eclipse CDT builder is making a number of changes to the environment. And yet, none of these changes are found within Eclipse's environment variables view. My conclusion is that Eclipse has some misconfiguration left over from an uninstalled plugin.

 

I am going to take this question to the Eclipse forum. I will report back when a conclusion is reached. For now, thanks for your help.

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I figured out the issue. For the sake of others, go to C/C++ Build -> Environment and add SYSTEMROOT=C:\Windows