Lock using static libraries *.a

Hello,

I would like to link a static library into my Arduino project. I have tested it for SAMD and AVR respectively ( Arduino Uno et Arduino Zero)

I have already read this topics:

I follow the instruction in order to add static library, then I can see it in the Contributed library (attached file)

Here is the source code of my compiled library :

int foo(void) {
  return 1;
}

Then, I create a library using ar tool.

I create a repo called foo which include

  • library.properties
  • and a repo src as below:
    -/src
    ---foo.h
    ---/{architecture_mcu_name}
    -----libfoo.a
name=foo                                                                                                 
version=0.0.1                                                                                            
author=lululuv1                                                                                            
maintainer=foo <foo@gmail.com>                                                                           
sentence=                                                                                                
paragraph=                                                                                               
category=Uncategorized                                                                                   
url=                                                                                                     
architectures=*                                                                                          
precompiled=true                                                                                         
ldflags=-lfoo

My foo.h contain the function prototype : int foo(void);

FInally I create the ino project, include the library....

#include <foo.h>

void setup() {
  Serial.begin(9600);

}

void loop() {
  int foo_value = foo();
  Serial.print("FOOFOOFOOFOOF");
}

Link with the library is done because if I want to link a libfoo.a from a dismatch architecture I got an error.

Hence, there is no compilation error, no link error but when i call the function foo(); I am lock, the print FOOFOOFOOFOO is never done.

Any idea ?

Thank you
PS: this is a simple example in order to reproduce the problem, can be done with avr-gcc or arm-none-eabi-gcc

It works for me when I do not use the prefix lib

-/src
---foo.h
---/{architecture_mcu_name}
-----foo.a