Hello Guix,
I recently explored the idea of adding "-DBUILD_SHARED_LIBS=TRUE" to
cmake-build-system's default configure-flags. This is just a summary of
the experience for future reference.
At the time of testing, there were 124 packages that use
cmake-build-system. Of those, 7 already explicitly set
BUILD_SHARED_LIBS=TRUE in their own #:configure-flags. Removing these,
and future, explicit uses was actually the motivator for this
experiment.
Here's a summary of the results, store dir sizes in K:
package current shared s/c
------- ------- ------ ---
pugixml 372 336 .903226
maim 96 96 1.000000
slop 84 84 1.000000
awesome 2144 2144 1.000000
webkitgtk 110780 110780 1.000000
rapidjson 552 552 1.000000
libyajl 252 252 1.000000
libwebsockets 3444 3444 1.000000
vtk 98736 98724 .999878
obs 9360 9360 1.000000
avidemux 26248 26248 1.000000
libgit2 1768 1768 1.000000
pfff 656 800 1.219512
taskwarrior 2848 2848 1.000000
synergy 2920 2920 1.000000
libssh 684 684 1.000000
slim 540 540 1.000000
cereal 6848 6852 1.000584
scribus 109228 109232 1.000037
clucene 5040 5040 1.000000
qtkeychain 268 268 1.000000
python2-tlsh 116 116 1.000000
python-tlsh 116 116 1.000000
gflags 404 404 1.000000
polkit-qt-1 472 472 1.000000
libpano13 1640 1640 1.000000
podofo 8716 8716 1.000000
keepassx 2524 2524 1.000000
drumstick 3088 3088 1.000000
yoshimi 9028 9028 1.000000
vmpk 1860 1860 1.000000
hydrogen 17408 17408 1.000000
zynaddsubfx 52700 52700 1.000000
portmidi 96 96 1.000000
taglib 1940 1940 1.000000
armadillo 4452 4456 1.000898
ceres-solver 3448 3448 1.000000
lapack 9656 9656 1.000000
dealii 253640 253644 1.000016
glm 2516 2516 1.000000
armadillo 4452 4456 1.000898
metis 700 700 1.000000
flann 19740 19740 1.000000
double-conversion 172 172 1.000000
gmsh 22072 22072 1.000000
superlu 572 572 1.000000
scalapack 5704 5704 1.000000
lxqt-session 712 712 1.000000
lxqt-common 4808 4808 1.000000
libqtxdg 516 516 1.000000
liblxqt 1056 1056 1.000000
clang-runtime-3.7.1 11964 11964 1.000000
clang-3.8.1 263760 50120 .190021
clang-runtime-3.8.1 13228 13228 1.000000
clang-3.5.2 176304 42724 .242331
llvm-3.5.2 297320 55024 .185067
clang-runtime-3.6.2 10584 10584 1.000000
clang-3.7.1 241220 46428 .192472
llvm-3.7.1 408884 67544 .165191
clang-runtime-3.5.2 8820 8820 1.000000
clang-3.6.2 170680 44028 .257956
llvm-3.8.1 492264 74696 .151740
llvm-3.6.2 333604 59352 .177912
unionfs-fuse-static 1204 1204 1.000000
pflask 84 84 1.000000
thinkfan 164 164 1.000000
unionfs-fuse 128 128 1.000000
libftdi 204 204 1.000000
snorenotify 1524 1524 1.000000
qca 3328 3328 1.000000
extra-cmake-modules 416 416 1.000000
kwindowsystem 2076 2076 1.000000
oxygen-icons 47184 47256 1.001526
quassel 20500 20500 1.000000
vigra 158284 158284 1.000000
openjpeg-1 536 536 1.000000
openjpeg-2.1 536 596 1.111940
perceptualdiff 80 80 1.000000
openjpeg-2.0 648 648 1.000000
cgal 38180 38196 1.000419
openimageio 17828 17828 1.000000
freeglut 1100 1100 1.000000
mars 75384 75384 1.000000
supertux 131656 131016 .995139
emulation-station 4264 4264 1.000000
allegro-5.2 2764 2764 1.000000
allegro-4 4528 2764 .610424
bullet 6392 4668 .730288
sfml 1928 1928 1.000000
allegro-5.0 2408 2408 1.000000
physfs 564 564 1.000000
graphite2 332 332 1.000000
fcitx 60 60 1.000000
stellarium 151712 151712 1.000000
doxygen 15808 15808 1.000000
mariadb 281328 281332 1.000014
mysql 213112 213108 .999981
cppcheck 3288 3288 1.000000
cmocka 152 152 1.000000
libcue 84 84 1.000000
libical 2616 2616 1.000000
diamond 832 832 1.000000
bamtools 2864 2864 1.000000
express 2532 2536 1.001580
flexbar 1260 1260 1.000000
openal 632 632 1.000000
csound 5040 5040 1.000000
soxr 324 324 1.000000
eigen 3684 3684 1.000000
dfc 168 168 1.000000
glfw 344 344 1.000000
So it appears that many packages are not affected by the change; llvm
and clang are most helped (with a small fix to the build phases), and
pugixml, allegro-4, and bullet to a lesser absolute degree. Many
packages apparently build shared libraries by default.
What is not included in the above list, however, are the packages that
FTBFS with BUILD_SHARED_LIBS=TRUE! A summary of those packages and the
issues:
blender => link error involving libjpeg.so version mismatches
ctl => validate-runpath failure
minetest => validate-runpath failure: libgmp.so cannot be found
aseprite => libbase-lib.so: undefined references to pthread_create, etc
conky => validate-runpath: bogus runpath entry, libtcp-portmem.so cannot
be found
withershins => link error: invalid relocation against `bfd_errmsg',
recompile with -fPIC
Based on this evidence, I think I'll just enable shared libraries in
directly in the llvm and clang packages, and forget adding the default
flag in cmake-build-system since its global impact would be minimal at
this point and even in the future and fixing the fallout is non-trivial.
Happy Hacking,
--
`~Eric