On Sunday, 13 November 2022 09:03:40 PST Henry Skoglund wrote:
> I can confirm "several tiny libraries" i.e. I had the same problem when
> building Qt on Ubuntu 22.04.
> After fiddling for a while, I took the easy way out:
> sudo apt-get install libxcb*
> That installed 68 libs (all beginning with libxcb-) probably overkill
> but at least it solved the problem :-)

Those XCB libraries are generated from the X specification, that's why there 
are so many of them. But this split up is counter-productive now.

As you've seen, it causes headache in forgetting just one of them. And as we 
add content to Qt, what built one version may not build the next, so you have 
to review after the upgrade.

The next problem is memory fragmentation. At a bare minimum, each library on 
Linux must be one read-only page containing code and one read-write page 
containing the GOT. Most Linux distros actually split a bit more for security, 
with a read-only non-executable page before the executable one, then one more 
after for read-only constant data and yet another for post-relocation read-
only, like so:

Address           Kbytes     RSS     PSS   Dirty    Swap Mode  Mapping
00007fed1e9e6000       4       4       0       0       0 r--p- libxcb-shm.so.
00007fed1e9e7000       4       4       0       0       0 r-xp-libxcb-shm.so.
00007fed1e9e8000       4       4       0       0       0 r--p- libxcb-shm.so.
00007fed1e9e9000       4       4       4       4       0 r--p- libxcb-shm.so.
00007fed1e9ea000       4       4       4       4       0 rw-p-libxcb-shm.so.

And the last two pages are not sharable between processes, so each one of 
those costs 5 VMA entries in the page tables, 8 kB of non-sharable data, and a 
bit of load-time work processing relocations.

All this for this tiny XCB library:
-rwxr-xr-x 1 root root 14416 Aug 31 05:33 /lib64/libxcb-shm.so.0.0.0

For Clear Linux, we've "tricked" the build to just merge all those libraries 
and libX11.so into a single .so, so they are loaded once only and occupy Much 
less memory.

Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering

Interest mailing list

Reply via email to