Segmentation Fault (Core dumped) when running cleanbuilt snap

I’m on ubuntu 18.04 and get another segmentation fault (core dumped) error when I try to run my snap.

$ facebookbuddy.fbuddy

(process:6447): Gtk-WARNING **: Locale not supported by C library.
Using the fallback ‘C’ locale.
Gtk-Message: Failed to load module “gail”
Gtk-Message: Failed to load module “atk-bridge”
Gtk-Message: Failed to load module “canberra-gtk-module”
I’m ok
I’m still ok
Segmentation fault (core dumped)

python startup-script looks like:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-

...

os.environ["TCL_LIBRARY"] = "/snap/facebookbuddy/x1/usr/share/tcltk/tcl8.6/"
os.environ["TK_LIBRARY"] = "/snap/facebookbuddy/x1/usr/share/tcltk/tcl8.6/"
print "I'm ok"
root = Tk()
print "I'm still ok"
gui = FriendsListWindow(root)
print "I'm still still ok"
tksupport.install(root)
root.protocol("WM_DELETE_WINDOW", on_closing)
root.mainloop()

class FriendslistWindow look like:

class FriendsListWindow:

    items = []
    buttons = []
    buttontexts = []
    pageurls = []
    current_ids = []
    _reactor_running = False
    _helper = None
    _current_page = 0
    _username = "" 
    _password = ""

    def __init__(self, master):
        self._helper = Helper()
        self.master = master
        master.title("The Facebook Buddy")

        conn = db.connect('database/friends.db')
        c = conn.cursor()
        c.execute('''CREATE TABLE IF NOT EXISTS 
...

…it creates a table with some columns and builds up the interface using tkinter…thats about it what’s inside __ init__(self,master):

strace facebookbuddy.fbuddy gives:

 stat("/root/snap/facebookbuddy/x1/.local/share/fonts", 0x7ffec9167f60) = -1 ENOENT (No such file or directory)
 stat("/root/snap/facebookbuddy/x1/.fonts", 0x7ffec9167ef0) = -1 ENOENT (No such file or directory)
 stat("/root/snap/facebookbuddy/x1/.fonts", 0x7ffec9167f60) = -1 ENOENT (No such file or directory)
 readlink("/proc/self/exe", "/snap/facebookbuddy/x1/usr/bin/p"..., 4096) = 40
 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
 writev(3, [{iov_base="b\0\4\0\6\0 \4", iov_len=8}, {iov_base="RENDER", iov_len=6}, {iov_base="\0\0", iov_len=2}], 3) = 16
 poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
 recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0(\0\0\0\0\0\1\213\0\216\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
 writev(3, [{iov_base="\213\0\3\0\0\0\0\0\v\0\0\0\213\1\1\0", iov_len=16}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 16
 poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
 recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0)\0\0\0\0\0\0\0\0\0\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 2548
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 recvmsg(3, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
 open("/usr/share/X11/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
 open("/usr/share/X11/locale/locale.dir", O_RDONLY) = -1 ENOENT (No such file or directory)
 open("/usr/share/X11/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
 open("/usr/share/X11/locale/locale.dir", O_RDONLY) = -1 ENOENT (No such file or directory)
 open("/usr/share/X11/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
 open("/usr/share/X11/locale/locale.dir", O_RDONLY) = -1 ENOENT (No such file or directory)
 uname({sysname="Linux", nodename="rolonso-T410", ...}) = 0
 open("/root/snap/facebookbuddy/x1/.Xdefaults-rolonso-T410", O_RDONLY) = -1 ENOENT (No such file or directory)
 --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=NULL} ---
 +++ killed by SIGSEGV (core dumped) +++
 Segmentation fault

I’ve built the snap using snapcraft --debug cleanbuild:
Here my part’s definition inside my snapcraft.yaml:

...
grade: devel 
confinement: devmode 
icon: images/fbuddy.png

apps:
  facebookbuddy:
    command: bin/facebookbuddy
    #plugs [network, x11]
    #desktop usr/share/applications/fbuddy.desktop
    
parts:
  fbuddy:
    source: .
    plugin: python 
    python-version: python2
    requirements: requirements.txt
    stage-packages: [python-tk, python-gobject-2, python-notify]

Any help would be greatly appreciated!

Were there warnings when building the snap?

Does adding ‘base: core18’ help? (See https://github.com/snapcore/snapcraft/releases )

No - no warnings. Unfortunately adding base: core18 doesn’t help either.
here the last couple of lines of the cleanbuild.

Successfully downloaded facebookbuddy Pillow Scrapy PyDispatcher six lxml Twisted service-identity w3lib pyOpenSSL parsel cssselect queuelib zope.interface constantly incremental Automat hyperlink PyHamcrest attrs pyasn1 pyasn1-modules cryptography functools32 setuptools idna enum34 asn1crypto cffi ipaddress pycparser
Preparing to build fbuddy 
Building fbuddy 
Looking in links: /root/build_facebookbuddy/parts/fbuddy/python-packages
Processing /root/build_facebookbuddy/parts/fbuddy/build
Collecting Pillow>=5.1.0 (from -r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 1))
  Saved /tmp/tmpd2d2mn7x/Pillow-5.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting Scrapy>=1.5.0 (from -r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/Scrapy-1.5.1-py2.py3-none-any.whl
Collecting PyDispatcher>=2.0.5 (from -r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 3))
Collecting six>=1.11.0 (from -r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 4))
  Saved /tmp/tmpd2d2mn7x/six-1.11.0-py2.py3-none-any.whl
Collecting lxml>=4.2.1 (from -r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 5))
  Saved /tmp/tmpd2d2mn7x/lxml-4.2.4-cp27-cp27mu-manylinux1_x86_64.whl
Collecting Twisted>=13.1.0 (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
Collecting service-identity (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/service_identity-17.0.0-py2.py3-none-any.whl
Collecting w3lib>=1.17.0 (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/w3lib-1.19.0-py2.py3-none-any.whl
Collecting pyOpenSSL (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/pyOpenSSL-18.0.0-py2.py3-none-any.whl
Collecting parsel>=1.1 (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/parsel-1.5.0-py2.py3-none-any.whl
Collecting cssselect>=0.9 (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/cssselect-1.0.3-py2.py3-none-any.whl
Collecting queuelib (from Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/queuelib-1.5.0-py2.py3-none-any.whl
Collecting zope.interface>=4.4.2 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
Collecting constantly>=15.1 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/incremental-17.5.0-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/Automat-0.7.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/hyperlink-18.0.0-py2.py3-none-any.whl
Collecting PyHamcrest>=1.9.0 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/PyHamcrest-1.9.0-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/attrs-18.1.0-py2.py3-none-any.whl
Collecting pyasn1 (from service-identity->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/pyasn1-0.4.4-py2.py3-none-any.whl
Collecting pyasn1-modules (from service-identity->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/pyasn1_modules-0.2.2-py2.py3-none-any.whl
Collecting cryptography>=2.2.1 (from pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/cryptography-2.3.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting functools32; python_version < "3.0" (from parsel>=1.1->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
Collecting setuptools (from zope.interface>=4.4.2->Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/setuptools-40.1.0-py2.py3-none-any.whl
Collecting idna>=2.5 (from hyperlink>=17.1.1->Twisted>=13.1.0->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/idna-2.7-py2.py3-none-any.whl
Collecting enum34; python_version < "3" (from cryptography>=2.2.1->pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/enum34-1.1.6-py2-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=2.2.1->pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.7 (from cryptography>=2.2.1->pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/cffi-1.11.5-cp27-cp27mu-manylinux1_x86_64.whl
Collecting ipaddress; python_version < "3" (from cryptography>=2.2.1->pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
  Saved /tmp/tmpd2d2mn7x/ipaddress-1.0.22-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.7->cryptography>=2.2.1->pyOpenSSL->Scrapy>=1.5.0->-r /root/build_facebookbuddy/parts/fbuddy/build/requirements.txt (line 2))
Skipping Pillow, due to already being wheel.
Skipping Scrapy, due to already being wheel.
Skipping six, due to already being wheel.
Skipping lxml, due to already being wheel.
Skipping service-identity, due to already being wheel.
Skipping w3lib, due to already being wheel.
Skipping pyOpenSSL, due to already being wheel.
Skipping parsel, due to already being wheel.
Skipping cssselect, due to already being wheel.
Skipping queuelib, due to already being wheel.
Skipping constantly, due to already being wheel.
Skipping incremental, due to already being wheel.
Skipping Automat, due to already being wheel.
Skipping hyperlink, due to already being wheel.
Skipping PyHamcrest, due to already being wheel.
Skipping attrs, due to already being wheel.
Skipping pyasn1, due to already being wheel.
Skipping pyasn1-modules, due to already being wheel.
Skipping cryptography, due to already being wheel.
Skipping setuptools, due to already being wheel.
Skipping idna, due to already being wheel.
Skipping enum34, due to already being wheel.
Skipping asn1crypto, due to already being wheel.
Skipping cffi, due to already being wheel.
Skipping ipaddress, due to already being wheel.
Building wheels for collected packages: PyDispatcher, facebookbuddy, Twisted, zope.interface, functools32, pycparser
  Running setup.py bdist_wheel for PyDispatcher ... done
  Stored in directory: /tmp/tmpd2d2mn7x
  Running setup.py bdist_wheel for facebookbuddy ... done
  Stored in directory: /tmp/tmpd2d2mn7x
  Running setup.py bdist_wheel for Twisted ... done
  Stored in directory: /tmp/tmpd2d2mn7x
  Running setup.py bdist_wheel for zope.interface ... done
  Stored in directory: /tmp/tmpd2d2mn7x
  Running setup.py bdist_wheel for functools32 ... done
  Stored in directory: /tmp/tmpd2d2mn7x
  Running setup.py bdist_wheel for pycparser ... done
  Stored in directory: /tmp/tmpd2d2mn7x
Successfully built PyDispatcher facebookbuddy Twisted zope.interface functools32 pycparser
Looking in links: /root/build_facebookbuddy/parts/fbuddy/python-packages
Collecting Automat
Collecting zope.interface
Collecting cryptography
Collecting Scrapy
Collecting pyOpenSSL
Collecting attrs
Collecting cssselect
Collecting pyasn1
Collecting parsel
Collecting Pillow
Collecting PyDispatcher
Collecting queuelib
Collecting incremental
Collecting lxml
Collecting hyperlink
Collecting pycparser
Collecting service_identity
Collecting w3lib
Collecting idna
Collecting PyHamcrest
Collecting enum34
Collecting Twisted
Collecting constantly
Collecting ipaddress
Collecting pyasn1_modules
Collecting functools32
Collecting cffi
Collecting asn1crypto
Collecting six
Installing collected packages: Automat, zope.interface, cryptography, Scrapy, pyOpenSSL, attrs, cssselect, pyasn1, parsel, Pillow, PyDispatcher, queuelib, incremental, lxml, hyperlink, pycparser, service-identity, w3lib, idna, PyHamcrest, enum34, Twisted, constantly, ipaddress, pyasn1-modules, functools32, cffi, asn1crypto, six
Successfully installed Automat-0.7.0 Pillow-5.2.0 PyDispatcher-2.0.5 PyHamcrest-1.9.0 Scrapy-1.5.1 Twisted-18.7.0 asn1crypto-0.24.0 attrs-18.1.0 cffi-1.11.5 constantly-15.1.0 cryptography-2.3.1 cssselect-1.0.3 enum34-1.1.6 functools32-3.2.3.post2 hyperlink-18.0.0 idna-2.7 incremental-17.5.0 ipaddress-1.0.22 lxml-4.2.4 parsel-1.5.0 pyOpenSSL-18.0.0 pyasn1-0.4.4 pyasn1-modules-0.2.2 pycparser-2.18 queuelib-1.5.0 service-identity-17.0.0 six-1.11.0 w3lib-1.19.0 zope.interface-4.5.0
/root/build_facebookbuddy/parts/fbuddy/install/usr/bin/python2 setup.py --no-user-cfg install --single-version-externally-managed --user --record install.txt
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/spiders
copying spiders/friendslist.py -> build/lib.linux-x86_64-2.7/spiders
copying spiders/timeline.py -> build/lib.linux-x86_64-2.7/spiders
copying spiders/base.py -> build/lib.linux-x86_64-2.7/spiders
copying spiders/mobilefriends.py -> build/lib.linux-x86_64-2.7/spiders
copying spiders/__init__.py -> build/lib.linux-x86_64-2.7/spiders
copying spiders/latestpost.py -> build/lib.linux-x86_64-2.7/spiders
running build_scripts
creating build/scripts-2.7
copying and adjusting facebookbuddy -> build/scripts-2.7
copying facebookfriends.py -> build/scripts-2.7
copying items.py -> build/scripts-2.7
copying tools.py -> build/scripts-2.7
copying settings.py -> build/scripts-2.7
copying pipelines.py -> build/scripts-2.7
changing mode of build/scripts-2.7/facebookbuddy from 644 to 755
running install_lib
creating /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/__init__.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/latestpost.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/timeline.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/mobilefriends.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/friendslist.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
copying build/lib.linux-x86_64-2.7/spiders/base.py -> /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/__init__.py to __init__.pyc
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/latestpost.py to latestpost.pyc
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/timeline.py to timeline.pyc
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/mobilefriends.py to mobilefriends.pyc
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/friendslist.py to friendslist.pyc
byte-compiling /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/spiders/base.py to base.pyc
running install_egg_info
running egg_info
writing facebookbuddy.egg-info/PKG-INFO
writing top-level names to facebookbuddy.egg-info/top_level.txt
writing dependency_links to facebookbuddy.egg-info/dependency_links.txt
reading manifest file 'facebookbuddy.egg-info/SOURCES.txt'
writing manifest file 'facebookbuddy.egg-info/SOURCES.txt'
Copying facebookbuddy.egg-info to /root/build_facebookbuddy/parts/fbuddy/install/lib/python2.7/site-packages/facebookbuddy-1.0-py2.7.egg-info
running install_scripts
copying build/scripts-2.7/facebookfriends.py -> /root/build_facebookbuddy/parts/fbuddy/install/bin
copying build/scripts-2.7/items.py -> /root/build_facebookbuddy/parts/fbuddy/install/bin
copying build/scripts-2.7/pipelines.py -> /root/build_facebookbuddy/parts/fbuddy/install/bin
copying build/scripts-2.7/settings.py -> /root/build_facebookbuddy/parts/fbuddy/install/bin
copying build/scripts-2.7/facebookbuddy -> /root/build_facebookbuddy/parts/fbuddy/install/bin
copying build/scripts-2.7/tools.py -> /root/build_facebookbuddy/parts/fbuddy/install/bin
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/facebookfriends.py to 777
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/items.py to 777
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/pipelines.py to 777
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/settings.py to 777
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/facebookbuddy to 755
changing mode of /root/build_facebookbuddy/parts/fbuddy/install/bin/tools.py to 777
writing list of installed files to 'install.txt'
Staging fbuddy 
Priming fbuddy 
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/libdb-5.3.so
Snapping 'facebookbuddy' /                                                                                                                                                             
Snapped facebookbuddy_1.0.2_amd64.snap
Retrieved facebookbuddy_1.0.2_amd64.snap
Stopping local:snapcraft-easily-just-cow

and again - after installing and running:

$ facebookbuddy 

(process:4376): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "canberra-gtk-module"
I'm ok
I'm still ok
Segmentation fault (core dumped)

Can you try running it under gdb? The command is: snap run --gdb facebookbuddy

Does it work on Ubuntu 16.04?

Have you gotten a minimal tcl/tk app running in snap?
( https://github.com/kushalchauhan98/minimal-snip is a possible example, but it had a problem )

I wonder if strict mode, and jumping through the hoops to use X there, might somehow accidentally help expose the issue. I see you started on that a bit already and commented it out.

e.g. something like

grade: stable
confinement: strict

...

apps:
  facebookbuddy:
    command:
       desktop-launch $SNAP/bin/facebookbuddy
    plugs [network, x11]
...
    after:
      - desktop-glib-only

iirc.