-
-
Notifications
You must be signed in to change notification settings - Fork 114
"Improve precompiled libraries handling" broke "mixed code" libraries #353
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
Comments
Hi @sierraatomic ,
@cmaglie any though on this? |
@facchinm, IIUC option #1 would mean that you always include binary files in the link, and I guess this all depends on the question whether there exists a usecase where you would ship sources files and a binary that was compiled from those same source files (as opposed to a binary that is complementary to the source files). My initial thought would be that this usecase does not actually exist. I can imagine shipping a binary might be needed for a closed-source component, but then you won't ship sources, obviously. If you can supply the source files for a library, then there is no need for the binary, you can just compile the sources. The only thing could be that you ship a binary as an optimization, but I suspect that it would be way better to just handle that using the caching we already have, which can already handle recompilation on changes automatically (and if you really want to supply a precompiled library for speed, you can just distribute a second copy of the library with just the precompiled files). Or am I missing a usecase now? As for |
@facchinm Just found this already open issue after realizing that 1.8.12 broke precompiled libraries that contain mixed code and binaries. Especially interesting find after going through the readme to see that this version "Improve precompiled libraries handling" (-: I have a library that I am making, it is a wrapper around a closed source library, I need to add my own code to the sources. So I need to be able to ship a library that contains both my code wrappers and the closed source binaries. For now I am forced to go back to 1.8.11. But would be nice to have this resolved. |
Hi @LowPowerLab , |
Some libraries takes a very long time to compile, so long that even once per session begins to be frustrating, basically the Personally I like the option 2: releasing the closed source lib as a separate lib (so it will be possibly reused by someone else?) BTW I see the pragmaticity of the option 1, so for me it's ok to do it (and make IDE 1.8.12 incompatible with those few libraries, I guess people will survive this). |
Hi @facchinm thanks for your response. If #1 option you mentioned (if I understand correctly) to use precompiled=false but with ldflags to link the .a/.so libraries and allow the mixed library, that would also be OK. My main goal is to allow the whole content in 1 library and not have to split it. You mentioned this would might require a tiny patch to work in 1.8.12 - I can build Arduino 1.8.12 myself to release to end user until patched version is released - is that patch something you could share so I can solve this now? |
This patch restores some functionalities broken by arduino#512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * arduino#512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled)
@LowPowerLab patch submitted arduino/arduino-cli#611 . To compile the builder the easiest way right now is
or I can provide binaries if you tell me your OS |
@facchinm Thanks, I am not sure when I can get to it and figure out how to make the builder, my OS is W10. |
@LowPowerLab exactly. In attachment the builder to replace the official one |
@facchinm Hmmm, maybe I'm doing something wrong. I tried 1.8.12 and also latest 1.8.13 build, replaced the arduino-builder.exe with your patched version, removed the precompiled=true in my library.properties, and left the ldflags as before pointing to the precompiled libs. I get the same compile errors as before:
|
@LowPowerLab may I get a preview of the library so I can test it myself? Feel free to mail it to m.facchin AT arduino.cc if you don't want to release publicly. |
This patch restores some functionalities broken by arduino#512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * arduino#512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled)
This patch restores some functionalities broken by arduino#512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * arduino#512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled)
This patch restores some functionalities broken by arduino#512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * arduino#512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled)
This patch restores some functionalities broken by arduino#512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * arduino#512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled)
* Fix mixed code precompiled libraries This patch restores some functionalities broken by #512 . It introduces a BREAKING CHANGE to "precompiled" field If merged, "precompiled" means that the library ONLY contains a precompiled library and its headers. No file containing implementation will be compiled if the library is specified as such. Fixes arduino/arduino-builder#353 Tested with * #512 (comment) (Nano33BLE and generic MKR board) * https://github.com/BoschSensortec/BSEC-Arduino-library (works after removing precompiled=true directive in library.properties) * https://github.com/vidor-libraries/USBBlaster (MKRVidor, fully precompiled) * Added test-build for Arduino_TensorFlowLite * Added another test for Bosch Sensor lib * Fallback search for precompiled libraries in non-fpu specific directories * variable renamed * Moved fixLDFLAG inside compileLibraries * Inlined FixLDflags * Using more paths helpers to simplify code * Added support for "precompiled=full" in library.properties This flag allow the deployment of a pure precompiled library that ships also the source code of the precompiled part. This allows to possibly compile-from-source as a fallback if the library does not provide a precompiled build for the current architecture. The "precompiled=true" instead has been ported back to the old behaviour (for libraries that ships a precompiled binary and support source code that wraps/uses the precompiled part). * Updated tests * Fixed test compile-build on very long paths on Windows * Removed constants.BUILD_PROPERTIES_COMPILER_LIBRARIES_LDFLAGS * Add space before "-L" gcc flag to allow multiple precompiled libs to be included Co-authored-by: Cristian Maglie <[email protected]>
When you have library with both precompiled and source code (precompiled!=source code), Arduino v1.8.12 will skip compilation phase, and you will get missing code error at linker phase.
If you change "precompiled=true" to "precompiled=false" it will compile the code, but will not add precompiled code to linker, and you will get missing code error (different code missing).
Example: https://github.com/BoschSensortec/BSEC-Arduino-library
It is compiling just fine on Arduino v1.8.11.
Looks like the reason for this behaviour is from:
General change:
The text was updated successfully, but these errors were encountered: