Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Unable to compile debug version; release version compiles fine (Read 3318 times)
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Unable to compile debug version; release version compiles fine
Dec 26th, 2019 at 9:59pm
Print Post  
Hello,

I've got a visual studio solution with an Arduino project and a shared project that contains all of my custom library code. When compiling in release mode, everything is fantastic, and I've been developing this solution in release mode (sadly) quite successfully for over a year now. It's a pretty typical solution, nothing overly complicated.

Historically I'd been living like a caveman and debugging to the serial console, cuz, well, that's how I'd been developing for Arduino for the previous 820 years. So, today I went through the debugging tutorial on the Visual Micro website, and things were great (using a simple sketch, no library or shared project). Excited to play with a new way of debugging, I opened up my solution and put the project in debug mode; it doesn't compile.

I'm getting a "Library folder does not exist" error that doesn't happen when building in release mode. Specifically the error is:

Using library workshop-climate-lib version 2.0.0 in folder "file:///C:/Users/jgall/Documents/Arduino/libraries/workshop-climate-lib"
Library folder does not exist: fruit_feather_m4\Debug\workshop-climate-lib
System.IO.DirectoryNotFoundException: Could not find a part of the path afruit_feather_m4\Debug\workshop-climate-lib'.

In release mode, this same library compiles fine, with the only difference being the output path being the release vs. debug version. Navigating to the build folder shows everything that I'd expect for the release version, but the debug version does not have the shared library folder like the release version does. Something, for whatever reason isn't getting copied over there?

I've attached the verbose build output for both the release (success) and debug (fail); I'm lost at what the issue might be. Both of these builds were cleaned and then re-built.

Any thoughts or support would be greatly appreciated!
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #1 - Dec 26th, 2019 at 10:15pm
Print Post  
This might be a clash with the memory-free library. If easy to try without using that lib it would prove the issue.

Otherwise, in debug mode, please click Build>Clean Solution and then build and post the output again.

Thanks
  
Back to top
WWW  
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #2 - Dec 26th, 2019 at 10:59pm
Print Post  
Thanks for such a fast response!

I've done a bit of testing between my workstation and my laptop and found something interesting; this same solution builds just fine on my laptop but not my workstation. Upon comparing settings, my workstation (where it fails) had Micro Debug > Library Debugging = true, while the same setting on my laptop had this value set to false. Changing the value to true on my laptop causes the debug build to fail, switching it back causes it to succeed. The same change on the workstation has the same effect. True value, debug builds fail, false value, debug builds succeed.

I've attached two build outputs (both run with clean solution > rebuild):

1. Debug configuration - library debugging = true
2. Debug configuration - library debugging = false

So I guess I have maybe a dumb question; to debug (breakpoints) my library code, I was assuming I needed this value to be set to true. Is this the case? If not, what does this setting do?

I'm hopeful that I'll be able to debug both my sketch and my library code. The separation of concerns is important to me.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #3 - Dec 27th, 2019 at 11:30am
Print Post  
The setting is not really required anymore since we support shared library projects. It will be removed from future releases.

  
Back to top
WWW  
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #4 - Dec 27th, 2019 at 4:34pm
Print Post  
Understood.

In your first response you thought this might be a clash with MemoryFree library rather than my own library (workshop-climate-lib). When you look at the log, what makes you lean in that direction?

Curious to learn more as I look at build output logs and troubleshoot these types of issues on my own Smiley

Thank you again for your help, still having issues getting this to build in debug mode.

Josh
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #5 - Dec 27th, 2019 at 4:52pm
Print Post  
Nothing in the log it is simply that the debugger uses a freeMemory lib and I just wanted to check it wasn't clashing. In theory it is only what the debugger adds that could clash and if you were using the default settings then that would be first to mind for me.

« Last Edit: Dec 27th, 2019 at 4:53pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #6 - Dec 27th, 2019 at 5:51pm
Print Post  
Understood.

I've removed my usage of the MemoryFree lib from my code, it was easy and only used in one place. Unfortunately it seems like something else in the project is referencing Arduino-MemoryFree, maybe the board... not sure.

So, I've cleaned and rebuilt in debug mode the solution with my references to MemoryFree.h commented out (along with dependent code so it would compile), and continue to get the directory not found error. I've attached the verbose build output.

I'm not really sure how to troubleshoot this past this point Sad
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #7 - Dec 27th, 2019 at 6:34pm
Print Post  
It's possible because you have a library with same name as the project butleaving Library Debuggin at the default = False will allow your debug bulds to work okay.

  
Back to top
WWW  
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #8 - Dec 27th, 2019 at 9:41pm
Print Post  
Makes sense, I'm much less confused now, thank you. For some dumb reason I was hung up on that library debugging setting.

On a tangential note to learn a bit more about debugging shared libraries... 

I created a solution with the sample blink project and added shared library project per your guide here: https://www.visualmicro.com/post/2017/01/16/Arduino-Cross-Platform-Library-Devel.... The shared library will have the blink logic in it, rather than in the arduino project. Nothing terribly fancy, just a blink.h and blink.cpp with the blink logic moved from the sketch into the .cpp.

For some reason, it doesn't seem to be working. Breakpoints in the sketch hit just fine, while the breakpoint I have set in the blink.cpp file does not get hit. I've attached a screenshot to see what I've got going on; I'm pretty confident that I've set up the two projects correctly, but I'm often wrong. Since there doesn't seem to be too many folks having this issue, I'm assuming the issue exists between seat and keyboard at this point, I'm just not sure why.



  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #9 - Dec 27th, 2019 at 9:45pm
Print Post  
when the build happens we combine all .ino code into the project_name.cpp in a temp folder. Rename your blink.cpp to something else and it will be ok.
  
Back to top
WWW  
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #10 - Dec 27th, 2019 at 10:07pm
Print Post  
OMG, name collision on my part, HAH!

So I renamed the blink files to BlinkTest.h and BlinkTest.cpp, and the class name to BlinkTest, and refactored to accommodate the change. Cleaned the solution and rebuilt + deployed to the M4.

Still no dice; my sketch breakpoints hit just fine, my library breakpoint does not. So I opened up the Blink.cpp file from the temp folder and it looks like a typical sketch with the Visual Micro debugging code added in. I see "BlinkTest.h" being included as I'd expect. I also see my BlinkLibrary project folder in the temp folder, and it has the refactored (blinktest) .d and .o files.
  
Back to top
 
IP Logged
 
Joshua Gall
Junior Member
**
Offline


Posts: 15
Joined: Nov 16th, 2018
Re: Unable to compile debug version; release version compiles fine
Reply #11 - Dec 29th, 2019 at 2:08pm
Print Post  
I've spent a good deal more time with this trying to get it to work, but have been unsuccessful. I've started to look into using visual micro with a hardware debugger, but in the meantime I'd really like to get this running to I can get back to my project.

I've attached my blink solution (sketch project and library project) and hoping someone could give it a once over to make sure I'm not missing something. Are there any settings in visual micro that I might have played with that would affect my ability to debug libraries?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to compile debug version; release version compiles fine
Reply #12 - Dec 29th, 2019 at 6:04pm
Print Post  
Sorry for the delay. 

I think the visual micro serial debug of libs is currently missing from the plugin. That is probably because a lot of people use relative path references to other header files from inside their libraries. However, when debug is enabled, relative paths in libraries fail in the same way as relative paths in arduino project code. This is because we have to copy the libraries into a temp build area to inject the serial debug code. We will update the docs or find a combined solution in the coming weeks.

Since we have moved to support GDB debug it provides debug of libraries along with single step and live variables. So it seems better than the visual micro serial debugger unless you want to plots graphs or see performance stats.

In any case with the Uno you can use GdbStub. GDBStub also uses serial + a library but you get the full hardware debug experience.

You can give it a try very easily. I just used it to debug the project you sent. There is an instructable that shows how to install the avr-debugging library and also shows the line of code you need to add to the setup() function. Remember to switch the optimation combox box to "No Project and Libraries" otherwise a  breakpoint will not be hit in the BlinkTest::FlashLED function.

https://www.instructables.com/id/Arduino-Uno-GDB-Debugging/


« Last Edit: Dec 29th, 2019 at 6:06pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint