Hi,
I am trying to package a pre-built application using snapcraft. I want to be able to package the ank-desktop client via a snap although I am having significant difficulties. This is my first attempt at creating a snap so I apologise in advance if I have not understood a concept correctly from the documentation.
Anki provides a tar of the pre-built binary so I thought this should map quite well to the existing geekbench example. Below is my initial snapcraft.yaml.
FYI - I am using a vagrant ubuntu xenial VM to build the snap then install it on to my host system.
# vim: tw=80 shiftwidth=4 tabstop=4 softtabstop=4 et ai
name: anki-desktop
version: 2.0.52
summary: Anki desktop client
description: |
Anki is a program which makes remembering things easy. Because it's a lot
more efficient than traditional study methods, you can either greatly
decrease your time spent studying, or greatly increase the amount you learn.
confinement: devmode
parts:
anki-desktop:
plugin: dump
source: https://apps.ankiweb.net/downloads/current/anki-$SNAPCRAFT_PROJECT_VERSION-amd64.tar.bz2
source-type: tar
apps:
anki:
command: anki
Within the tar, the bin folder contains anki and its various dependencies. On running snapcraft I recieve the following output:
vagrant@ubuntu-xenial:/vagrant_data$ snapcraft
Preparing to pull anki-desktop
Pulling anki-desktop
Downloading 'anki-2.0.52-amd64.tar.bz2'[==============================================] 100%
Preparing to build anki-desktop
Building anki-desktop
Staging anki-desktop
Priming anki-desktop
Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part:
usr/lib/x86_64-linux-gnu/libICE.so.6
usr/lib/x86_64-linux-gnu/libSM.so.6
usr/lib/x86_64-linux-gnu/libX11.so.6
usr/lib/x86_64-linux-gnu/libXau.so.6
usr/lib/x86_64-linux-gnu/libXdmcp.so.6
usr/lib/x86_64-linux-gnu/libXext.so.6
usr/lib/x86_64-linux-gnu/libfontconfig.so.1
usr/lib/x86_64-linux-gnu/libicudata.so.55
usr/lib/x86_64-linux-gnu/libicuuc.so.55
usr/lib/x86_64-linux-gnu/libxcb.so.1
usr/lib/x86_64-linux-gnu/libxml2.so.2
'grade' property not specified: defaulting to 'stable'
Snapping 'anki-desktop' /
Snapped anki-desktop_2.0.52_amd64.snap
In the above output I am confused why various shared libraries are not satisfied. If these are missing how could I determine so?
When attempting to install and run the snap. The following occurs:
(Notice I am using anki-desktop.anki to ensure it is running the ank command from the snap.)
➜ anki-desktop-snap git:(master) ✗ sudo snap install anki-desktop_2.0.52_amd64.snap --devmode --dangerous
[sudo] password for rad:
anki-desktop 2.0.52 installed
➜ anki-desktop-snap git:(master) ✗ anki-desktop.anki
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
File "aqt/__init__.py", line 12, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
File "aqt/qt.py", line 10, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
File "anki/__init__.py", line 14, in <module>
Exception: Anki requires a UTF-8 locale.
runanki returned -1
➜ anki-desktop-snap git:(master) ✗
Why hasn’t snapd or the snap I created taken the locale from the host system?
Viewing localectl output shows that the host system and the VM used to build the snap contain a UTF locale.
###Arch Host:
➜ anki-desktop-snap git:(master) ✗ localectl
System Locale: LANG=en_GB.UTF-8
VC Keymap: uk
X11 Layout: gb
➜ anki-desktop-snap git:(master) ✗
###Ubuntu Xenial VM:
vagrant@ubuntu-xenial:/vagrant_data$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: n/a
X11 Layout: us
X11 Model: pc105
vagrant@ubuntu-xenial:/vagrant_data$
Is it possible to get some kind of shell into the snap container to inspect the environment and determine what is wrong?