VS Arduino
>> >> Target to create a static library
https://www.visualmicro.com/forums/YaBB.pl?num=1635759836

Message started by Taragorm on Nov 1st, 2021 at 9:43am

Title: Target to create a static library
Post by Taragorm on 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.

Title: Re: Target to create a static library
Post by Tim@Visual Micro on 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?

Title: Re: Target to create a static library
Post by Taragorm on 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.

Title: Re: Target to create a static library
Post by Tim@Visual Micro on 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

Title: Re: Target to create a static library
Post by Taragorm on 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.

Title: Re: Target to create a static library
Post by Tim@Visual Micro on 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).

Title: Re: Target to create a static library
Post by Taragorm on 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.

Title: Re: Target to create a static library
Post by Simon@Visual Micro on 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-Archives.aspx

This does not (yet) automatically rebuild the archive when the code changes, or when a different board architecture is selected.

Title: Re: Target to create a static library
Post by Taragorm on Nov 27th, 2021 at 3:47pm
Thanks, I'll give it a try

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.