Snapcraft breaking over nested cmake, not moving built files into staging/prime, and dependency issues

I am trying to build my first snap from a Github project, jangernert/FeedReader.

Issue 1. I can’t use the cmake plugin in Snapcraft because it breaks down when encountering nested cmake files in the WebExtension submodule of the jangernert/FeedReader project, even though the make files generated work fine.

Issue 2. So I tried using a build script to call cmake, make, and make install and that appears to build. See https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft.yaml, But none of the built libraries and binaries come over into staging or prime, even though I specify they should and other parts, specifically the latest valac, built by the autotools plugin do come over.

Issue 3. The github project I am building also has upstream meson build features, so I pulled those in and tried using snapcraft’s meson plugin for a yaml here: https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft-meson-version.yaml. But it fails with gcc, glibc, and zlib issues, see the link.

Can anyone point me in the right direction? Thank you!

UPDATE: Upstream project has switched to Meson. #1 and #2 may still be issues with cmake and build scrips that snap should look into but I am now focused on solving issue #3.

Here are the files that end up in my /snap/feedreader/current/ on the first snapcraf.yaml.

None of the bits I built in the build script though.

Here is the thread on the issue over on the GitHub project.

Here is a bug report I filed on Snapcraft.

Hey, nice, I created a snap for FeedReader on my side as well, which I haven’t published yet as I need to do some relocations for the GTK webprocess it starts up. I’ll share my snapcraft.yaml if you want.

There are a few issues in your yaml though,

      build: |
        mkdir build
        cd build
        cmake ..
        make
        sudo make install

Is not really needed, I would remove that and let the plugin do its thing. What is most worrisome is the use of sudo make install, what you really want is make install DESTDIR=$SNAPCRAFT_PART_INSTALL, but all in all, you do not need this bit of code.

Thank you for your response.

The reason I did the build script is because the cmake plugin in snapcraft fails, inexplicably, on one of the dependant components, /WebExtension/, see the log in the first post of the GitHub thread.

sudo make install, what you really want is make install DESTDIR=$SNAPCRAFT_PART_INSTALL

Would that explain why none of the binaries and libraries built by sudo make install are brought over into the snap even though they are listed under snap: or prime:?

Update

I made your proposed change to my snapcraft.yaml, see https://gist.github.com/sirredbeard/20864b9ca0fb000a9cee80c56ee7b1a2, and ran it.

It built but again, none of the feedreader files came over into the final snap, only the vala files, see https://gist.github.com/sirredbeard/e153da228bf92dab9da269a831bfc79d

nope, you didnt …

you changed “make install” to “make” (plus a DESTDIR variable) :wink:

Okay, I did it for real this time.
Same problem.
Nothing built in the feedreader part by make and then make install is getting pulled into the snap.

See my snapcraft.yaml, a listing of all files in my snapcraft project, build log, and snap commands here.

https://gist.github.com/sirredbeard/ba5e6ed8d910dfa182d274e595b3c297

install and DESTDIR are transposed:

make DESTDIR=$SNAPCRAFT_PART_INSTALL install

Thank you.

The upstream project has now switched to Meson, so while issues #1 and #2 might still be issues with snap creation, and your fix may work, I am now focusing on issue #3, getting snap to build with the Meson plugin.