RedisInsight / RedisDesktopManager

https://resp.app
Other
22.93k stars 3.27k forks source link

snap version is huge (1.1GB), shall we have stripped binary? #5207

Closed yurenchen000 closed 2 years ago

yurenchen000 commented 2 years ago

version

$ snap list  redis-desktop-manager
Name                   Version            Rev  Tracking       Publisher  Notes
redis-desktop-manager  2022.0.2+f79a564f  599  latest/stable  uglide     -

Is your feature request related to a problem?

RESP.app is awsome, and snap is easy to use. It's the best redis gui client I've ever used.

just that the snap version is very huge, 1.1GB .snap, 2.7G after mount. it would be perfect if it could be smaller.

Describe the solution you'd like

After a little investigation, I found that the large files are mainly dependent libraries, which are debug version, not stripped. If we have stripped binarys, the file size should be much smaller.

some details:

$ ls -lh /var/lib/snapd/snaps/redis-desktop-manager_599.snap
-rw------- 2 root root 1.1G 3月   3 23:48 /var/lib/snapd/snaps/redis-desktop-manager_599.snap

$ du -had1 /snap/redis-desktop-manager/599/
22K /snap/redis-desktop-manager/599/bin
0   /snap/redis-desktop-manager/599/data-dir
122K    /snap/redis-desktop-manager/599/etc
512 /snap/redis-desktop-manager/599/flavor-select
0   /snap/redis-desktop-manager/599/gnome-platform
425K    /snap/redis-desktop-manager/599/lib
3.0K    /snap/redis-desktop-manager/599/meta
136M    /snap/redis-desktop-manager/599/opt
110K    /snap/redis-desktop-manager/599/snap
2.6G    /snap/redis-desktop-manager/599/usr
2.8G    /snap/redis-desktop-manager/599/


largest files:

$ find /snap/redis-desktop-manager/599 -size +100M | xargs ls -lh  | sort -k5r
-rwxr-xr-x 1 root root 199M 2月   9 22:20 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.2
-rwxr-xr-x 1 root root 185M 2月   9 22:30 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5.15.2
-rwxr-xr-x 1 root root 177M 2月   9 22:33 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.15.2
-rwxr-xr-x 1 root root 175M 2月   9 22:44 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5XmlPatterns.so.5.15.2
-rwxr-xr-x 1 root root 146M 2月   9 22:22 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.2
-rwxr-xr-x 1 root root 118M 2月   9 22:16 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.2

try to strip a .so:

$ strip -s /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.2 -o /run/test/libQt5Gui.so.5.15.2-stripped

$ ls -lh /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.2 /run/test/libQt5Gui.so.5.15.2-stripped
-rwxrwxr-x 1 chen chen 7.0M 3月   5 04:37 /run/test/libQt5Gui.so.5.15.2-stripped
-rwxr-xr-x 1 root root 199M 2月   9 22:20 /snap/redis-desktop-manager/599/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.2

199M → 7M, size reduce significant effect.

uglide commented 2 years ago

Thanks for the detailed feedback. If you have spare time please submit PR with fixes to snap repo https://github.com/RedisDesktop/redisdesktopmanager-snap

yurenchen000 commented 2 years ago

Thanks for the detailed feedback. If you have spare time please submit PR with fixes to snap repo https://github.com/RedisDesktop/redisdesktopmanager-snap


workaround

I'm new to snapsnapcraft.yaml, after little dig, I realized that: qt build flag -force-debug-info caused the debug version so (which is large).

--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -219,7 +219,6 @@ parts:
        -sysconfdir /etc/xdg \
        -examplesdir /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/examples \
        -release \
-       -force-debug-info \
        -opensource \
        -confirm-license \
        -system-freetype \

I just remove it, build on snapcraft.io, and test the .snap file,


test build

test file can be download here: https://launchpad.net/~build.snapcraft.io/+snap/eab9cbc132ca0e1fc59975d7c0203dea/+build/1697167

$ sudo snap install --devmode  ./resp-app-test_2022.2+594318e6_amd64.snap

$ ls -lh resp-app-test_2022.2+594318e6_amd64.snap 
-rwxrwxr-x 1 chen chen 262M 3月   9 03:55 resp-app-test_2022.2+594318e6_amd64.snap

$ du -had1 /snap/resp-app-test
747M    /snap/resp-app-test

.snap file reduce to 262MB, mount size 747MB.

try to run it, everything seems same as orig version.


still want debug info of qt ?

-force-debug-info -separate-debug-info I guess the two flag will generate separete debug info, which may not increase release file.

uglide commented 2 years ago

Merged. Thanks!