-
-
Notifications
You must be signed in to change notification settings - Fork 114
Allow precompiled libs #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
A precompiled library should provide: - a header file defining the functions (like a normal library) - some folders named after {build.mcu} containing the precompiled files It should declare - precompiled=true in its library.properties The precompiled files can be either static (.a) or dynamic (.so). In the latter case, the maintainer should take extra care to ensure that the exported symbol versions are matching the remote board's
As of now, Library.Name maps to the folder it resides in, not the name declared in library.properties It could be a bug or a feature, anyway since need to we use the real library name, extract it and save in the structure
Combined with Library.precompiled flag, allows a developer to ship a precompiled library. The linker (ld in our case) needs static libraries to be explicitely included in the build (it doesn't try any heuristic). Luckily, "including" a dynamic library in this way works as well, so we can avoid the "-L" and "-l" dance
✅ Build completed. ⬇️ Build URL: ℹ️ To test this build:
|
Since ld uses absolute paths in certain conditions, adopt a different strategy for dynamic libraries. "compiler.c.elf.extra_flags" must be defined and used in "recipe.c.combine" (at least)
✅ Build completed. ⬇️ Build URL: ℹ️ To test this build:
|
Do you know when this will be part of the Arduino-builder release? |
Hi, Is there any news on when this will be included into the official Arduino release? Corjan |
@Corjan85 it is included in IDE 1.8.6 and upwards; for an example of the usage, take a look at arduino/ArduinoCore-samd@37c8d4f (the commit is used to link https://github.com/vidor-libraries/USBBlaster library) |
The rule name has been changed here to avoid clash with already defined flags |
Hi, Thanks for your reply. I think have done the same as the USBBlaster library. This is my library.properties:
This is what happens during the linking step:
It seems the ldflags are ignored. The custom build arduino_builder.exe higher up in this post seems to add the ldflags. Could it maybe be a feature that is only supported on SAM devices? Since the USBBlaster only targets SAM. I'm targetting atmega328p, atmega2560 and ATmega32U4. Any help is appreciated, Corjan |
Forget to tell, but I'm using Arduino 1.8.7. I have done a reinstall, and made sure to delete everything from program files and user documents folder, just in case... Corjan |
Yes, at the moment only |
Ah, that makes sense :) |
Allow dynamic and static libraries linking at runtime.
Please note that no library of this kind will be included in the library manager since we would be unable to enforce that the license is compliant with the actual library "content"