Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Encountering an error building - Environment variable name or value is too long (Read 6388 times)
JeffW
Newbies
*
Offline



Posts: 8
Encountering an error building - Environment variable name or value is too long
Aug 12th, 2016 at 4:49pm
 
Hi There!

I've been using Visual Micro and loving it.  In particular, I've been exploring and learning how to use an Arduino DUE and MEGA 2560 along with an IMU and GPS, trying to learn how flight controllers actually work.  As part of that, I've been getting into the ArduPilot code.  I've found some nice work-arounds to get it compiling better without all sorts of custom Arduino builds, and have a project that I think *mostly* works, except that VSMicro is now giving me an error:

System.ArgumentException: Environment variable name or value is too long.
   at System.Environment.SetEnvironmentVariable(String variable, String value)
   at System.Environment.SetEnvironmentVariable(String variable, String value, EnvironmentVariableTarget target)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino._compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp._CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.Compile(Project oProject, Boolean IsDebugStartCommand, Boolean IsRebuild, Boolean UseGdbIfAvailable)

Everything works fine for other projects, but not this one.

Any suggestions on what I can do to get more info on the exact cause of the error or how to fix it?

Thanks,
~Jeff

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #1 - Aug 12th, 2016 at 5:27pm
 
Hi, that's good to hear (apart from the error).

Please switch on vMicro>Compiler>Verbose and also "Show build properties"

Then build and post the output as a .txt or email to info[at]visualmicro.com

Please a link to the arduPilot code you are using

On another note I added support for ardupilot projects some time ago. Maybe useful.

http://www.visualmicro.com/post/2013/05/02/APM-Installation-Guide.aspx
Back to top
 
WWW  
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #2 - Aug 13th, 2016 at 10:57pm
 
The source I'm building is here:
https://github.com/JeffyW/ardupilot/tree/development

It's a branch off master-AVR (since I want to build for arduino) with some tweaks.  I'm using arduino build 1.6.10.

The build output is here:
https://gist.github.com/JeffyW/7e36b44de546cd10c147449f36d4e28d
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #3 - Aug 13th, 2016 at 11:38pm
 
Thanks

The build process creates a few environment variables just in case an external process or build hook want to use them. There is a new release of visual micro which excludes attempting to see variables for "include path list" and "object files list". There weren't really needed and I suspect the object file list was the one that blew the windows limit.

Let me know if the new build fixes it if not then I will add some diagnostics.
Back to top
 
WWW  
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #4 - Aug 15th, 2016 at 4:53pm
 
That does seem to work much better.  It got past the issue with variables, but now I'm getting:
https://gist.github.com/JeffyW/0071330c42ae3fd8762c04938b08bcc5

Maybe using relative instead of absolute paths would help?
Back to top
 
 
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #5 - Aug 15th, 2016 at 4:54pm
 
Or maybe a configuration option to allow us to specify what dir to use as the temp build location, allowing me to configure something like C:\vm in place of C:\Users\jeffy\AppData\Local\Temp\VMicroBuilds\ArduCopter\mega_atmega2560.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #6 - Aug 15th, 2016 at 4:57pm
 
You can change the temp build folder in tools,options,visual micro,locations

But the paths in your extract don't look to long so maybe something else.

Switch on the vMicro>Compiler>Show build properties then post the entire output or email to info[at]visualmicro.com

Thanks

Back to top
« Last Edit: Aug 15th, 2016 at 5:06pm by Visual Micro »  
WWW  
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #7 - Aug 16th, 2016 at 3:47pm
 
So sorry, should have left that on after last time.  I've updated the GIST with the full output (verbose and build properties).

I've switched my temp build location to c:\t just to see if shortening the path would help.  After doing so, I got past the earlier error about the filename being too long, but then get other errors from the linker which appear to be due to things going out of order (or something being incorrectly omitted).  I'm still working through this, but it does appear that having a long root to temp can definitely be a problem.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #8 - Aug 16th, 2016 at 4:07pm
 
It's a standard arduino build and everyone uses the same temp without issue so I am expecting to see something else such as a problem with double quotes or something.

Can you please confirm a link to your latest verbose output

Thanks
Back to top
 
WWW  
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #9 - Aug 16th, 2016 at 5:06pm
 
Here's a link to the output from *before* I changed my temp path to "c:\t":
https://gist.github.com/JeffyW/0071330c42ae3fd8762c04938b08bcc5

And here's a link *post*:
https://gist.github.com/JeffyW/c9bff09d011fd7e9bc165d6ac77b1072

Something odd I'll note is that I set my configuration such that Arduino was configured with a sketchbook location of c:\Github\scratch, but VS Micro had a sketchbook location of c:\Github\Ardupilot (where the rest of the code actually was), yet the build process only seemed to add a *single* library from c:\Github\Ardupilot\libraries (specifically AP_Common).  I had to include *all* other libraries in the actual project file in order for VS Micro to reference them.  You can see this in the logs I posted where the g++ calls have -I"C:\GitHub\ardupilot\libraries\AP_Common", but nothing else.  Also, the \t directory now contains a subfolder for AP_Common but none of the other libraries, and the sources / .o files for AP_Common are *also* included in the root folder (likely because I also included those files in the proj file).

Through a recent test, changing the arduino sketch folder to point to ardupilot, removing the optional VS Micro config setting, build=>clean, restart visual studio, then rebuild, and it seems like no difference (to either refer to more libraries or to the build output).
Back to top
 
 
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #10 - Aug 16th, 2016 at 5:10pm
 
Sorry, there *is* a reference to -I"C:\GitHub\ardupilot\libraries" in the build lines, but I guess what I meant to say was I'm confused why there would *also* be a call out to AP_Common specifically.

Also to note are my Tools->Options->Visual Micro settings, all of the "Compatability" options are true.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #11 - Aug 16th, 2016 at 5:11pm
 
Please clear the sketchbook folder and restart the ide. When empty it will use the one from the arduino ide.

Please confirm that the exact same project code then builds okay in arduino but not in visual micro

And please don't change any visual micro options.

Thanks
Back to top
« Last Edit: Aug 16th, 2016 at 5:12pm by Visual Micro »  
WWW  
IP Logged
 
JeffW
Newbies
*
Offline



Posts: 8
Re: Encountering an error building - Environment variable name or value is too long
Reply #12 - Aug 18th, 2016 at 3:03pm
 
Ok, well I was trying to get a newer branch to build.  Apparently in that branch they did things like move from #include <file.h> to #include <folder/file.h>.  Arduino doesn't like this because it won't check in subfolders of the sketch libraries for these, so Arduino itself didn't work.

When reverting to an older branch (last known good for the platform), I'm able to get VS Micro to build it (although Arduino still won't because the main pde is referring to something defined in another pde - where I can simply include both in the .csproj in  VS Micro).

TBH, I only really cared about using VS Micro, not Arduino to code, and was hoping to find a way to get the build environment to actually work for building this code.

Ah well, maybe I'll just have to update the newer release's code to just work for me.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10338
United Kingdom
Re: Encountering an error building - Environment variable name or value is too long
Reply #13 - Aug 18th, 2016 at 4:05pm
 
Thanks for the update. I am happy to try it now we have a stable report. The ArduPilot project is excellent but prone to different versions from different people.

If you switch off "vMicro>Compiler>Deep Search" you might run into less issues as long as all required libraries are #included in the project_name.pde

Arduino has two lib formats. The newer format expects a text file called library.properties to exist in the library root. Then the lib code in a sub folder called \src and below that an unlimited number of sub folders can be used and referenced from the lib code with relative folder path as you have suggested.

If you look in arduinoide\hardware\avr you should see a libraries folder such as Wire that has an example of the new layout.

Not sure if that helps but worth mentioning.

I'll take a look over the next week or so when time allows.
Back to top
« Last Edit: Aug 18th, 2016 at 4:05pm by Visual Micro »  
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print