-
-
Notifications
You must be signed in to change notification settings - Fork 413
Experiment building NUT with shared private libraries #3251
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
base: master
Are you sure you want to change the base?
Conversation
9b07638 to
0c2b095
Compare
|
Interim result on a Linux build: Toggling the flag got about 2x savings: Several private libs delivered: Some lessons learned:
|
|
Missed updating some further recipes in that iteration. Here's the example change for |
|
Regarding the concern of binaries losing the version identification: as of current commit, they do (when built with shared libs mode), as seen below. Files that retain the ID include the new libs and For comparison, the build in default (legacy) mode has a lot more hits; notably only |
|
Footprint changes with Windows seem more drastic, about 6x for some drivers e.g.: There is also decent potential in re-using USB code, and maybe some other popular inner and third-party dependency groups that apply to several drivers but not to all of them. Overall in this iteration for Windows builds, this saved 3x the space: This hopefully might lead to faster Appveyor CI builds (especially the late part about archival and compression, eventually MSI packaging) that nowadays too often times out beyond the 1hr allowance. |
|
❌ Build nut 2.8.4.3963-master failed (commit 36d652e3c9 by @jimklimov) |
198c186 to
684e886
Compare
|
✅ Build nut 2.8.4.3966-master completed (commit 0e02f36f1d by @jimklimov) |
|
With latest commit, flipped the switch for default WIN32 build via UPDATE: got a 2x reduction in installation footprint, and a bit in the packed archive too:
|
|
❌ Build nut 2.8.4.3967-master failed (commit 09c5210e10 by @jimklimov) |
|
❌ Build nut 2.8.4.3970-master failed (commit b3a40888fc by @jimklimov) |
|
After some back-and-forth in the sources, went for several ways of securing this design:
|
|
✅ Build nut 2.8.4.3971-master completed (commit 92a252ba6e by @jimklimov) |
|
A few questions:
|
|
|
Reviewing commit-by-commit should be reasonable, at least I fixed-up most of the found glaring errors into commits that originally introduced them. A few fixes come as separate commits though, as it was easier to sync multi-system development and testing sometimes. |
…ing a newly made structure (with expected NULL references) [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…rix with BUILD_TYPE=default-all-errors and explicit requests via WITH_LIBNUTPRIVATE envvar [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ivate* dependency definitions (also wants libcommonversion) [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
… common lib just in case so far [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…AVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_MISSING_FIELD_INITIALIZERS{,_BESIDEFUNC} to quiesce stuff={0} initializations (warnings with ancient compilers) [networkupstools#2800]
Signed-off-by: Jim Klimov <[email protected]>
…io_utest.c, tests/driver_methods_utest.c: wrap calls to register/validate callbacks with ignorance of "address" and "unreachable code" warnings [networkupstools#2800] Some compilers detect that a persistent structure's address would never be NULL so some conditions are always FALSE and some code never runs. The downside of using macros vs. methods... Signed-off-by: Jim Klimov <[email protected]>
networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ds into a separate shell call Signed-off-by: Jim Klimov <[email protected]>
…orkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…n-private.la for builds where we ENABLE_SHARED_PRIVATE_LIBS so programs have their versions built in and can consult what the library thinks about itself [networkupstools#2800] Costs about 30Kb (Linux with debug) per binary (upsc) for the now re-embedded version data and a few methods to show it. But still saves 200K compared to a build without libnutprivate. Signed-off-by: Jim Klimov <[email protected]>
…ols#2800] Signed-off-by: Jim Klimov <[email protected]>
…S for now, stick with default (no) [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ibcommonclient.la for ENABLE_SHARED_PRIVATE_LIBS mode [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…e ABS_TOP_{BUILD,SRC}DIR values
Signed-off-by: Jim Klimov <[email protected]>
…h libdummy_mockdrv and libcommonversion [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…naries keeping their version info inside, libnutscan is also such a binary as far as third-party consumers are concerned [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…utprivate-*common*.la [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ff via upsdrv_callback_t too [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…lting of WITH_LIBNUTPRIVATE envvar toggle for WIN32 (cross-)builds [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
… on MacOS for now, stick with default (no) [networkupstools#2800]" This reverts commit 520539e : issue was fixed by passing version data/methods into drivers using the callback mechanism made for upsdrv_*() implementations. Signed-off-by: Jim Klimov <[email protected]>
…nclient.la [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ARED_PRIVATE_LIBS [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…ARED_PRIVATE_LIBS more conservatively [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…n we configure --without-serial Signed-off-by: Jim Klimov <[email protected]>
…ot currently mean disabling modbus drivers nor libnutscan ability to talk serial Signed-off-by: Jim Klimov <[email protected]>
…mmy_usb.la [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…mmy_usb.la [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
…g of suggest_NDE_conflict() when we ENABLE_SHARED_PRIVATE_LIBS [networkupstools#2800] Signed-off-by: Jim Klimov <[email protected]>
|
Rebased for a cleaner merge and easier final review. |
Follows up on issue #2800 by minimizing the repetitions of binary code in NUT programs, by delivering a few SO/DLL/... libraries with
libcommon*contents.Probably the existing static libs will still be built to optionally produce shared ones from them, in particular for
libnutscannerandlibupsclientconsumers to work unmodified (whatever symbols were exported from the well-known library names before should continue being exported and not need consumer rebuilds). In my short experiments it seems the symbol visibility is not transitive, at least not on all platforms (so having alibupsclientknown dynamically linked to somelibnutcommondoes not help final programs see debugging etc. methods from common code).Hopefully, on most operating systems the use of shared dynamic objects (loaded by several running NUT programs) should also use less RAM, than when each binary carries its own copy.