Repository navigation
bcc: remove refs to LLVM static libs that bloated closure - #562660
Conversation
|
|
nixosTests.bpf is still happy. |
|
Oh I see, bcc links with clang/llvm static libraries hmm... Technically I'd rather go the other way around: keep the large closure but set ENABLE_LLVM_SHARED=ON so the code isn't duplicated, which would save space on systems that pull in clang anyway (albeit much less impressive than your ~1.7G to ~300M (398.8MB locally) -- it only reduces bcc itself from 160M to 18M), but I can see your point and some "production" environments could want bcc without the huge llvm libs... Would it perhaps make sense to do both? e.g. make bcc shared but add a new bcc-staticllvm subpackage (through an option to the bcc package.nix) that links statically as currently with your remove-references-to added? Either way if we keep remove-references-to I'd rather add a check that llvm is statically linked (e.g. ldd |
|
I don't want to split into shared/static. Shared would be better, (with |
bfe0e82 to
2d7031a
Compare
|
added disallowedReferences |
Right, perhaps llvm closures can be reworked somehow but that does sound like more work... I think at this point prioritizing this closure size or prioritizing the whole store size with llvm installed is more of a project decision than a maintainer decision, so happy to defer to whoever knows about it -- would you be kind enough to bring it up on discourse or somewhere it can get attention perhaps? Ideally I'd see something like:
(BTW moving the .a out would only reduce the closure size by about 350MB (so 1.7GB -> 1.55GB from dynamic linking bcc -> 1.2GB from not keeping llvm .a around), I'm not sure this is good enough for you)
Thanks |
|
Sadly I don't have the time to try to rework anything in the LLVM package set at the moment. There's a discussion somewhere in matrix about trying to fix the .a files not to get pulled in for LLVM, not going to try to permalink to it because I can never get matrix search to work. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
winterqt
left a comment
There was a problem hiding this comment.
Chatted a bunch in-person about this. I think this is a fine stopgap to avoid bloating closure size.
|
Thanks for merging. As said above I'm fine with this as a stopgap, but I'd like to switch to dynamic linking once the llvm situation improved (or provide two bcc variants if there are strong reasons to want to make the bcc closure smaller, but tbh bcc is a dev tool and I don't see the point of optimizing too hard for this specific closure size over the full system closure size, for production you'd be better served with the libbpf-tools binaries (WIP #488231 - I believe these would be small and not depend on llvm at all)) I searched open issues but couldn't find anything, is there somewhere I could watch? |
|
I don't think nuking unwanted refs to a store path like this is a stopgap - this is done frequently in nixpkgs - and don't see how it's related to deciding whether to have dynamically or statically linked bcc. Don't afaik think anyone is working on fixing the .dev / .lib split for static and shared libs properly. Until that's fixed, dynamic linking against LLVM will still result in huge static libs in the closure. |
|
Well, your reason to do this was to reduce the closure size, so unless llvm .dev/.lib gets split that means you'd rather not do dynamic linking? My systems that have bcc also have bpftrace which is already dynamically linked to llvm, so from my (user) point of view switching to dynamic linking would reduce my system's closure size (by about 140MB), but I can understand that someone who's not already bringing in llvm would prefer bloating bcc itself by doing static linking... Anyway, ok for nobody working on it, I've run out of time for today but I'll open an issue later just to track the issue |
|
swapping it to dynamic and eating the cost again is ok, don't want to block that, sorry. pkgsStatic.bcc as a simple end user option with no ref to llvm.lib would be good to keep working. prior issues / PRs:
here be dragons |
|
Thanks for all the links! I've glanced over the issues/reverted PR and while a generic solution isn't in sight it looks like something for llvm might be possible if we can fiddle a bit with the cmake rules to install in separate directories (as that'll make llvm-config automagically work), with the additional load of checking nixpkgs for people pointing at .a directly from llvm.lib... |
Reduces closure from ~1.7G to ~300M
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.