0

I know to make a library on arduino ide with source codes, but I cant send my source code to another users who want to use my lib.

So I need to make a library with precompiled=true info at library.properties. And I need to put my .a and .so files at src/{build.mcu} (in my case, src/avr/mylib.a and mylib.so).

But, where is that files (.a and .so)?!

Does the arduino compiler generate this files? If so, where? If dont, how compiler I need to use?

I found the .o file at appData\local\Temp\arduino_build_XXXX\libraries\mylib\

Thank you very much and sory about my english.

0
  • Note: I have never done this with the Arduino IDE, so I don't know if the resultant file will be of any use to you.

A .a file (you don't want a .so file - that's a shared library that makes no sense on a platform without an OS) is merely an archive (ar archive, specifically) that contains one or more .o files.

You create one simply enough using:

avr-ar rcs myLib.a myLib.o

You will find the avr-ar program in the tools installation within your Arduino IDE somewhere.


As an aside, UECIDE (which I wrote) uses library files like these to cache its libraries and other compiled code. You can use UECIDE to directly grab a .a file for your library, which you would find in the cache folder of the UECIDE data folder (find it through the Help -> Debug menu).

0

Thank you Majenko!

But, the program is not avr-ar for me, I use the avr-gcc-ar.

After that, I must to dot_a_linkage=true in my library.properties and manually add mylib.a at AppData\Local\Temp\arduino_build_115676\libraries\mylib\

I dont know why, but this help for me.

I hope help other.

Best regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.