Having trouble snapping a mono app

I’m currently trying to snap pinta, an open source paint program written in C#. While I have figured out how to build the application (including applying a patch from debian in a slightly hackish manner), I’m currently stuck at it being unable to find glib-sharp, even after I added it under stage-packages.

After some investigation it appears that the packages GAC (global assembly cache) entries do not exist in the snap, mono needs these entries in order to locate the DLLs and load them. In fact, a lot of the entries for other dependencies are missing from the snap’s GAC as well. The GAC directory is located under /snap/pinta-casept/current/usr/lib/mono/gac/ in the snap and under /usr/lib/mono/gac on the host.

My first hunch is that maybe the debian package doesn’t actually contain these entries (instead generating them at install time), but I’m not sure. Can anyone with more experience snapping mono apps chime in here and help me out? The snapcraft.yaml and related files are available at https://github.com/casept/snap-pinta.

One option I have considered is copying the GAC entry from the build host, but that doesn’t seem like the “right way” to do it.

This provides some relevant background when packaging pre-built binaries (shared-packages, etc):

Does that help somehow?

1 Like

Thanks for the link! Unfortunately, that’s not the issue I’m facing. My problem isn’t that mono can’t find the location where the GAC entries should be (I set MONO_GAC_PREFIX to tell it where to look), it’s that the entries are entirely missing from the snap’s filsesystem.

If entries are missing, the files were simply not installed, so perhaps there are still required packages missing that need to be listed. I’m not familiar with mono so can’t tell what those are.

@sergiusens Any ideas here?

@mhall119 Do you know of someone else snapping mono software that could help @casept?

1 Like

I need to dive into mono or dot.net core myself.

By quickly looking at https://launchpad.net/ubuntu/+archive/primary/+files/mono-addins_1.0+git20130406.adcd75b-4.debian.tar.xz there’s an installcligac hook run upon installation which you can dive into here http://manpages.ubuntu.com/manpages/trusty/man1/dh_installcligac.1.html that generates what you need.

Alternatively you could compile these DLLs from source.

1 Like

I think that’s what I was looking for, thanks!

@sergiusens has confirmed my suspicion that the files are installed by a debhelper script (which snapcraft seems to not execute for stage-packages). I’ll probably end up going with installing the packages on the host under build-packages, letting the script generate the GAC entries. Then it should just be a matter of copying them into the snap part. Perhaps not the cleanest solution, but it would probably work.

My suggestion was to use prepare and run whatever is done in that debhelper and get them into the appropriate paths.

@casept hey I’m having a similar problem, did you solve yours?