Jenyay / snap-examples

Examples for snapcraft
2 stars 1 forks source link

How to build for Ubuntu 18.04 #1

Closed abulka closed 5 years ago

abulka commented 5 years ago

Thanks for these examples. I'm trying to build your last example 0.5 for Ubuntu 18.04, so changed

    python-packages:
        - https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl

to

    python-packages:
    - https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl

Note the change from 16.04 to 18.04, and the change from cp35 to cp37 (presumably this is what is needed for my Python 3.7). I'm getting the error:

Pulling testsnap-py 
wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl is not a supported wheel on this platform.
Failed to run '/home/andy/Devel/snap-examples/v_0.5.1/parts/testsnap-py/install/usr/bin/python3 -m pip download --disable-pip-version-check --dest /home/andy/Devel/snap-examples/v_0.5.1/parts/testsnap-py/python-packages https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl': Exited with code 1.

I get the same error when I substitute any of the previous versions of wxPython listed at https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ viz

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.3-cp37-cp37m-linux_x86_64.whl
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.2-cp37-cp37m-linux_x86_64.whl

They all give the same error. Investigating my platform info:

$ python3 -c "import pip; print(pip.pep425tags.get_platform())"
linux_x86_64
$ python3 -c "import pip; print(pip.pep425tags.get_abi_tag())"
cp37m
$ python3 -c "from pip import pep425tags;print(pep425tags.supported_tags)"
[('cp37', 'cp37m', 'manylinux1_x86_64'), ('cp37', 'cp37m', 'linux_x86_64'), ('cp37', 'abi3', 'manylinux1_x86_64'), ('cp37', 'abi3', 'linux_x86_64'), ('cp37', 'none', 'manylinux1_x86_64'), ('cp37', 'none', 'linux_x86_64'), ('cp36', 'abi3', 'manylinux1_x86_64'), ('cp36', 'abi3', 'linux_x86_64'), ('cp35', 'abi3', 'manylinux1_x86_64'), ('cp35', 'abi3', 'linux_x86_64'), ('cp34', 'abi3', 'manylinux1_x86_64'), ('cp34', 'abi3', 'linux_x86_64'), ('cp33', 'abi3', 'manylinux1_x86_64'), ('cp33', 'abi3', 'linux_x86_64'), ('cp32', 'abi3', 'manylinux1_x86_64'), ('cp32', 'abi3', 'linux_x86_64'), ('py3', 'none', 'manylinux1_x86_64'), ('py3', 'none', 'linux_x86_64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

Any idea what I am doing wrong?

Jenyay commented 5 years ago

Try to install wheel package with

python -m pip install wheel
abulka commented 5 years ago

Hi thanks. Yeah that was already installed. I decided to start with clean Ubuntu 16.04 (not 18.04) like you did and try my luck. I was able to build and run the snap. I did get a build warning

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/libpython3.5m.so.1.0

should libpython3.5m.so.1.0 or something be added to the snapcraft.yaml?

Also, when I run, I get the error

$ testsnap-py -h
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

but the wxPython app luckily still runs. Any thoughts on how serious this error might be and how to avoid it?

Jenyay commented 5 years ago

usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0

No, I did not add this file.

Gtk-Message: Failed to load module "canberra-gtk-module"

See this link - https://askubuntu.com/questions/208431/failed-to-load-module-canberra-gtk-module

Also you can see other my snap package with wxPython - https://github.com/Jenyay/outwiker/blob/dev/need_for_build/snap/snap/snapcraft.yaml

I build it in Ubuntu 16.04 with "snapcraft cleanbuild" command

abulka commented 5 years ago

Thank you for that information and all your examples. Your OutWiker looks interesting, though the download page https://jenyay.net/Outwiker/English doesn't seem to give an easy one click snapcraft install url? I'm curious, isn't that the whole point of using snap?

If you ever get a chance, it would be great if you could add an example for building your tiny test app using Python 3.7 and wxPython 4.04 using the new, recommended, "core18" approach that snapcraft 3.0 uses. There is no official wheel for wxPython using Python 3.7 under Ubuntu 16.04, so I need to build under 18.04.

Apparently the new core18 multipass/vm based approach means changes to the snapcraft.yaml file as there are no longer remote parts https://docs.snapcraft.io/remote-reusable-parts/4233, which are lines like after: [desktop-gtk3] There is a post https://forum.snapcraft.io/t/snapcraft-3-core18-and-desktop-apps/9520 that talks about how to replace that remote part reference with a new "desktop-gtk3:" part as well as another post https://bugs.launchpad.net/snapcraft/+bug/1800057 that attempts to do something similar, though I am really out of my depth with this stuff, as I suspect other changes to the yaml file will be needed, and I find the official documentation sparse, complex and unhelpful. I'm just a wxPython developer who wants to get a snap app built for my linux users - not a linux guru! I think many wxPython users would appreciate such an example, if you ever have time.

Jenyay commented 5 years ago

Thank you for that information and all your examples. Your OutWiker looks interesting, though the download page https://jenyay.net/Outwiker/English doesn't seem to give an easy one click snapcraft install url? I'm curious, isn't that the whole point of using snap?

At the moment, snap is being used with the beta version - https://jenyay.net/Outwiker/UnstableEn

If you ever get a chance, it would be great if you could add an example for building your tiny test app using Python 3.7 and wxPython 4.04 using the new, recommended, "core18" approach that snapcraft 3.0 uses.

I have not tried to build a snap from core18. I hope that I will find time to try.

As for wxPython. Maybe build wheel manually? The build process is pretty simple there. I wrote a docker files for my tasks - https://github.com/Jenyay/outwiker/tree/dev/need_for_build/build_wxpython

abulka commented 5 years ago

Gtk-Message: Failed to load module "canberra-gtk-module" See this link - https://askubuntu.com/questions/208431/failed-to-load-module-canberra-gtk-module

Thanks for that link. Ok so I installed that locally

sudo apt install libcanberra-gtk-module

and also added

stage-packages:
    - libcanberra-gtk-module

to the snapcraft.yaml. Unfortunately the error/warning still appears when I build, install then run the snap locally.

Not sure what happens when the snap is actually deployed to other people, because I haven't been able to push the 0.5.1 snap example built with core18 yet because of an issue I have documented in #2. Would you have any other ideas on how to fix the canberra-gtk errors/warnings?

$ testsnap-py -h
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

P.s. I also tried sudo apt-get install libcanberra-gtk-module:i386 locally - same errors. And adding libcanberra-gtk-module:i386 to the snapcraft.yaml makes the snapcraft build fail - Failed to fetch stage packages: Error downloading packages for part 'andy-testsnap-py': The package 'libcanberra-gtk-module:i386' was not found.

abulka commented 5 years ago

Turns out everybody building snaps gets this error, and it is just a warning

the canberra stuff is fine and normal (it just tells you that it wont play sound events for button clicks and other GTK events), that isnt fatal or anything and all snap apps show it on all distros (brcause the desktop helper simply does not include canberra). https://forum.snapcraft.io/t/spotify-failed-to-load-module-canberra-gtk-module/6379