This Time Self-Hosted
dark mode light mode Search

The use of shared libraries

I already blogged some time ago about the importance of using external shared libraries as much as possible instead of internal duplicated code.

One of the code most subtle because duplicated in a lot of packages is xpdf’s code, that’s also known more for its security problems than for its features. Luckily, FreeDesktop started the poppler library to provide shared access to the code, fixed and updated to avoid duplicating always the same code in different projects and then having to patch all of them if a vulnerability is found.

Unfortunately, not all the software is already updated to use this code. In particular KPDF, also 3.5, still duplicates the code, and this requires bumps and fixes every time a security update is released (for this reason kpdf is always the most revbumped KDE package).

But thanks to jriddell, the problem is partly solved πŸ™‚ He prepared for KUbuntu a patch that uses poppler instead of the internal copy of xpdf; patch that I’ve updated a bit to fix the autofoo support (never hardcode /usr in a distribution that is working for prefix support πŸ˜‰ ), and then applied to kpdf and kdegraphics 3.5.1-r2. This does not only mean that finally with new security vulnerabilities there’s no need to patch kpdf/kdegraphics and let the users rebuild them, but it also mean that kpdf is lighter, because the code from xpdf is now removed. In my system, with splitdebug, -g -ggdb, the version using poppler was 3MB smaller.

So Ian, now you see why downstream has this strange passion for dynamic linking? πŸ™‚

Update: I’ve seen that by using +cairo on poppler, the performance of KPDF really improves sensibly, also compared to original KPDF with internal xpdf code. Good thing, eh? πŸ™‚
Update 2: tsdgeos (KPDF maintainer) let me know that KPDF still don’t use cairo also if poppler is being built with +cairo… so I’m not really sure about the boost above stated, it’s really there, I double checked it, but might be triggered by something else, no idea about that… the strange ways GCC creates code..

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.