guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Experimenting with reduced gcc-lib


From: Julien Lepiller
Subject: Experimenting with reduced gcc-lib
Date: Thu, 8 Dec 2022 22:32:54 +0100

Hi Guix!

I had a look at gcc to try and reduce its footprint. I figured gcc-lib
contained shared and static libraries as well as support libraries for
gdb, many headers and compiler runtime, that are taking a lot of space
when they are not needed at runtime. Reducing its 33.4 MiB would help
create smaller guix packs, have smaller system and profile closures,
etc.

I figured gcc has a --with-slibdir option that is advertised as being
useful to specify a directory for the shared libraries. I decided to
use it and create a new output for the gcc package, shared-lib. In
fact, this option only installs libgcc_s.so in that output, and that's
the only thing required by most packages.

Attached is a patch that divides gcc-lib into gcc-static-lib and
gcc-shared-lib (not very good names, gcc-static-lib contains shared
libs too).

Before the patch we get:

guix size perl
total: 147.7 MiB

After the patch:

./pre-inst-env guix size perl
total: 114.5 MiB

This is because before the patch, gcc-lib is 33.4 MiB, and after the
patch gcc-shared-lib is only 0.2 MiB.

I don't want to push that patch as is, because libstdc++.so is still in
the gcc-static-lib output and will bring all the useless stuff with it.
C++ programs will bring back the remaining 33.2 MiB.

Another possible target is glibc, since the only useful bits in there
are libc.so and ld-linux.so (I think?). This could reduce the closure
of our packs by another ~40 MiB (I think our systems would still need
most of the content of this package).

Attachment: 0001-gnu-gcc-Separate-lib-output.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]