Snap package file too big #10326
-
I've tried to build a snap package for my tauri 2 app, following the instructions we have in the docs (https://v2.tauri.app/distribute/snapcraft/), but my final snap package has 3GB, while my app has only 17MB after a regular build. Is there anything I can do to avoid that to happen? Here's my repo with the snapcraft.yml file: https://github.com/charlesschaefer/addiction-tracker |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey, thanks for the report. I just updated the template in the docs and since i used your app to test it, i still have the app specific config for you to try: name: addiction-tracker
base: core22
version: '0.0.4'
summary: An app to help with your addiction # 79 char long summary
description: |
Addiction tracker helps you to stop your addiction by giving you more consciousness over how you
use substances and the triggers and emotions related to the use.
grade: stable
confinement: strict
layout:
/usr/libexec/webkit2gtk-4.1:
symlink: $SNAP/usr/libexec/webkit2gtk-4.1
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1:
symlink: $SNAP/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1
/usr/lib/aarch64-linux-gnu/webkit2gtk-4.1:
symlink: $SNAP/usr/lib/aarch64-linux-gnu/webkit2gtk-4.1
/usr/lib/webkit2gtk-4.1/injected-bundle:
symlink: $SNAP/usr/lib/webkit2gtk-4.1/injected-bundle
apps:
addiction-tracker:
command: usr/bin/addiction-tracker
desktop: usr/share/applications/addiction-tracker.desktop
plugs:
- wayland
- x11
package-repositories:
- type: apt
components: [main]
suites: [noble]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
parts:
build-app:
plugin: dump
build-snaps:
- node/20/stable
- rustup/latest/stable
build-packages:
- libwebkit2gtk-4.1-dev
- build-essential
- curl
- wget
- file
- libxdo-dev
- libssl-dev
- libayatana-appindicator3-dev
- librsvg2-dev
- dpkg
stage-packages:
- libwebkit2gtk-4.1-0
- libayatana-appindicator3-1
- libglu1-mesa
- freeglut3
source: .
override-build: |
set -eu
npm install
npm run tauri build -- --bundles deb
dpkg -x src-tauri/target/release/bundle/deb/*.deb $SNAPCRAFT_PART_INSTALL/
sed -i -e "s|Icon=addiction-tracker|Icon=/usr/share/icons/hicolor/32x32/apps/addiction-tracker.png|g" $SNAPCRAFT_PART_INSTALL/usr/share/applications/addiction-tracker.desktop The snap instructions didn't see much use yet so please reach out again if you spot more issues ❤️ |
Beta Was this translation helpful? Give feedback.
-
That's great. Thank you so much for your help. I was wondering why the file had the build phase inside override-pull, but didn't know snapcraft sufficiently to change that. I had to change the app section to change from Thanks for your help. I'll change that file in the documentation and create a PR to the docs repository. |
Beta Was this translation helpful? Give feedback.
-
Oh, I was able to build the snap, but trying to run one specific part of the app where the user can choose a file to "upload" to the app, I got the errors below: (addiction-tracker:343280): GLib-GIO-WARNING **: 16:51:47.762: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
(addiction-tracker:343280): Gtk-WARNING **: 16:51:47.801: Could not find the icon 'user-home-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
http://icon-theme.freedesktop.org/releases
(addiction-tracker:343280): Gtk-WARNING **: 16:51:47.801: Could not load a pixbuf from /org/gtk/libgtk/icons/16x16/status/image-missing.png.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
Bail out! Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /org/gtk/libgtk/icons/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)
[1] 343280 IOT instruction snap run addiction-tracker To solve this problem, I needed to add the gnome extension on my "app" part, and add :desktop, :home and :unity7 plugs. Now it is working as expected. This is my final file: name: addiction-tracker
base: core22
version: '0.0.7'
summary: An app to help with your addiction # 79 char long summary
description: |
Addiction tracker helps you to stop your addiction by giving you more consciousness over how you
use substances and the triggers and emotions related to the use.
grade: stable
confinement: strict
layout:
/usr/libexec/webkit2gtk-4.1:
symlink: $SNAP/usr/libexec/webkit2gtk-4.1
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1:
symlink: $SNAP/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1
/usr/lib/aarch64-linux-gnu/webkit2gtk-4.1:
symlink: $SNAP/usr/lib/aarch64-linux-gnu/webkit2gtk-4.1
/usr/lib/webkit2gtk-4.1/injected-bundle:
symlink: $SNAP/usr/lib/webkit2gtk-4.1/injected-bundle
apps:
addiction-tracker:
extensions:
- gnome
command: usr/bin/addiction-tracker
desktop: usr/share/applications/addiction-tracker.desktop
plugs:
- wayland
- x11
- home
- desktop
- unity7
package-repositories:
- type: apt
components: [main]
suites: [noble]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
parts:
build-app:
plugin: dump
build-snaps:
- node/20/stable
- rustup/latest/stable
build-packages:
- libwebkit2gtk-4.1-dev
- build-essential
- curl
- wget
- file
- libxdo-dev
- libssl-dev
- libayatana-appindicator3-dev
- librsvg2-dev
- dpkg
stage-packages:
- libwebkit2gtk-4.1-0
- libayatana-appindicator3-1
- libglu1-mesa
- freeglut3
source: .
override-build: |
set -eu
rustup default stable
npm install
npm run tauri build -- --bundles deb
dpkg -x src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb $SNAPCRAFT_PART_INSTALL/
sed -i -e "s|Icon=addiction-tracker|Icon=/usr/share/icons/hicolor/32x32/apps/addiction-tracker.png|g" $SNAPCRAFT_PART_INSTALL/usr/share/applications/addiction-tracker.desktop
slots:
dbus-daemon:
interface: dbus
bus: session
name: com.addictiontracker |
Beta Was this translation helpful? Give feedback.
Oh, I was able to build the snap, but trying to run one specific part of the app where the user can choose a file to "upload" to the app, I got the errors below: