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....
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Target to create a static library (Read 194 times)
Taragorm
Newbies
*
Offline



Posts: 5
Target to create a static library
Nov 1st, 2021 at 9:43am
 
Is there any way to make a project that builds to a static lib instead of an image?

I have a esp32 project that links huge numbers of files, which is causing linker failures (because the command line is too long), and takes a long time. I got it to link only by moving the temp dir and shortening the paths, but that's a stopgap, not really a solution.

If I could pre-link the main libs into a .a, that would improve things immeasurably.
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11149
United Kingdom
Re: Target to create a static library
Reply #1 - Nov 1st, 2021 at 1:41pm
 
There are a few things that can be done. +We are considering adding options to the IDE that should avoid some of the donkey work to implement it.

The following guide for "dot_a_linkage" and "precompiled" gives some insight. https://wiki.seeedstudio.com/Software-Static-Library/.

Ignore the article when it explains how to see verbose output and the build folder. You can follow the guide in the yellow box above to enable verbose output.

Visual Micro uses the same build rules as the arduino ide which is why the above link also applies.

After changing library or build commands outside of the ide, either click "vMicro>General>Reload toolchains" or restart the ide.

Does this help?
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Taragorm
Newbies
*
Offline



Posts: 5
Re: Target to create a static library
Reply #2 - Nov 1st, 2021 at 1:49pm
 
Thanks.

It's certainly a step in the right direction. I will need some free time to evaluate though.

What I was hoping to do, is have the .a as part of the project, and have a dependancy to it. I've done this many times in non-arduino C++ projects, and it seems to be the right thing to do here.
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11149
United Kingdom
Re: Target to create a static library
Reply #3 - Nov 1st, 2021 at 2:23pm
 
You can put .a files in a \libs folder below the project/sketch folder. They will automatically be linked. The dot_a_linkage flag would allow you to build a ".a"

However it's all a bit clunky and we suspect the end result will leave you without any intellisense for the linked libs.

We are working on a "one-click" solution that will allow the library sources to remain as they are (for various reasons, such as intellisense and update/changed lib sources validation). The result should be faster library deep search, faster compilation with shorter build commands whilst still being Arduino compatible.

Click the notifications button in the new releases section of this forum for interim release notifications.

Hope that helps
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Taragorm
Newbies
*
Offline



Posts: 5
Re: Target to create a static library
Reply #4 - Nov 1st, 2021 at 3:12pm
 
Sorry,
I wasn't clear enough - I mean have the project that builds the .a as part of the overall solution, and have the .a rebuilt as needed, and used by the main project.
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11149
United Kingdom
Re: Target to create a static library
Reply #5 - Nov 1st, 2021 at 4:17pm
 
Yes you were clear and we are talking about the same thing. Behind the scenes it would simply implement the arduino spec for precompile but that complexity would be hidden from users (except when verbose is enabled).
Back to top
« Last Edit: Nov 1st, 2021 at 4:19pm by Tim@Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
Taragorm
Newbies
*
Offline



Posts: 5
Re: Target to create a static library
Reply #6 - Nov 1st, 2021 at 4:26pm
 
Good - I wasn't certain, I'd said enough.

It would certainly be a highly desirable feature IMO. The Arduino type builds are OK for 8bit type projects where the code size is limited, but once you start with 32bit stuff, it gets really slow.

Visual Micro goes a long way to putting a better IDE on top of the Arduino build system.
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1057
Re: Target to create a static library
Reply #7 - Nov 24th, 2021 at 10:33pm
 
An initial release of this functionality is now available, and documented below:
https://www.visualmicro.com/page/How-to-Automatically-Pre-Compile-Library-Archiv...

This does not (yet) automatically rebuild the archive when the code changes, or when a different board architecture is selected.
Back to top
 
 
IP Logged
 
Taragorm
Newbies
*
Offline



Posts: 5
Re: Target to create a static library
Reply #8 - Yesterday at 3:47pm
 
Thanks, I'll give it a try
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print