Using precompiled library with Arduino 2.2.1

I would like to use precompiled libraries to reduce compile times with Arduino IDE 2.2.1. I posted this question on an Arduino forum, and someone suggested this is a toolchain issue because it works as expected with an atmega328p.

I’ve read the Arduino CLI Library Specification, searched the Arduino and Sparkfun forums, and Google, for “precompiled library”, “The platform does not support ‘compiler.libraries.ldflags’”, found numerous posts about fixing it, but nothing I’ve tried has worked.

The target board is a Sparkfun Redboard Artemis ATP (aka apollo3).

I have a simple test.ino program that includes one library to test with:

//test.ino

#include <Utils.h>

void setup() {

}

void loop() {

}

The compiler finds my library no problem. This is a snipet of what I get in the output window:

[…]

Compiling libraries…

Compiling library “Utils Library”

Library Utils Library has been declared precompiled:

Using precompiled library in d:\Projects\Arduino\libraries\Utils\src

The platform does not support ‘compiler.libraries.ldflags’ for precompiled libraries.

[…]

In libraries\Utils I have these files/folders:

src (folder)

library.properties

library.properties contains this:

name=Utils Library

version=0.0.0

author=lahr

maintainer=lahr <lahr@~~~~~~.~>

sentence=Utils Library

paragraph=Provides Common GP Utilities

category=Other

url=

architectures=*

depends=

dot_a_linkage=true

precompiled=full

In the src folder I have these files:

libUtils.a

Utils.cpp

Utils.h

I’ve searched my C: drive for every instance of platform.txt and copied a platform.local.txt file into those folders that contains this line:

compiler.libraries.ldflags=

When that didn’t fix it I also tried editing every platform.txt file to add the above line, and to modify the recipe.c.combine.pattern line:

recipe.c.combine.pattern=“{compiler.gcc.cmd}” “-T{build.ldscript}” “-Wl,-Map,{build.path}/{build.project_name}.map” -o “{build.path}/{build.project_name}.axf” {object_files} {libs.all} {compiler.ld.flags} {compiler.libraries.ldflags} {defines.ld}

I have spent many hours chasing this problem, and no change. Is it possible to do this with IDE v2.2.1?

Thanks!

Larry

Once I saw this topic… I wondered what ??

As such I did a deepdive to understand, analyze precompiled libraries and find a solution for the Sparkfun Artemins/Apollo3 V2.2.1 library. The issue is NOT because of the Arduino-IDE… it is a combination of Sparkfun’s library and the compiler.

Attached in the zip file is a document that can be opened by any word processor providing insight in

  • pros and cons for pre-compiled libraries

  • developing and using pre-compiled libraries with Arduino-IDE

  • what changes to apply for Sparkfun’s Apollo3 boards library to make it to work
  • Next to that find the adjusted boards.txt and platform.txt for the V2.2.1 Sparkfun’s Apollo3 boards library if you do not want to make the changes yourself.

    This has been tested and working on both 1.18.16 and V 2.2.2 Arduino-IDE

    pre-compiled.zip (40.8 KB)

    attached an updated version due to some typo errors in different files

    precompiled.zip (41.4 KB)