Snapcraft not handling cmake nested builds, not including build script files in snap, and dependency issues with meson builds

Bug #1766101 reported by Hayden
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned
snapcraft (Ubuntu)
New
Undecided
Unassigned

Bug Description

snapcraft, version 2.41+18.4.2

I am trying to build my first snap from a Github project, jangernert/FeedReader. There is no Debian/Ubuntu package available and the Flatpak is broken.

feedreader is a cmake-based project, with meson recently added on a testing branch. Snapcraft needs to download and build the latest valac in the snap because what comes on most distros is woefully out of date, including the Snapcraft build machine. Getting and building valac works fine with autotools.

But I have run into three issues trying different approaches:

Issue 1. I can’t simply let the cmake plugin in Snapcraft handle everything because it breaks down when encountering nested cmake files in the WebExtension submodule of the FeedReader project:

[ 11%] Built target gtkimageview
[ 11%] Linking C static library librss-glib.a
[ 11%] Building C object libVilistextum/CMakeFiles/vilistextum.dir/unicode_entities.c.o
[ 11%] Building C object libVilistextum/CMakeFiles/vilistextum.dir/util.c.o
[ 11%] Built target i18n
[ 11%] Building C object libIvy/CMakeFiles/ivy.dir/Stacktrace.c.o
[ 12%] Building C object libVilistextum/CMakeFiles/vilistextum.dir/vilistextum.c.o
[ 12%] Built target rss-glib
[ 12%] Linking C static library libvilistextum.a
[ 12%] Built target vilistextum
[ 12%] Linking C static library libgd.a
[ 12%] Built target gd
[ 13%] Linking C static library libivy.a
[ 13%] Built target ivy
[ 14%] Linking C shared library libwebextension.so
[ 14%] Built target webextension
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Failed to run 'make -j8' for 'feedreader': Exited with code 2.
Verify that the part is using the correct parameters and try again.

Issue 2. So I tried using the "build-override" scripting option in the cmake plugin to call cmake, make, and make install myself and that appears to build without the issue above. But none of the built libraries and binaries come over into staging or prime, even though I specify they should with snap:, which is what I described here. Other parts, specifically the latest valac built by the autotools plugin, do come over, just them in fact. So when you try to run this snap, it gives me a "feedreader" not found error because there are no feedreader files, just spiffy new valac files.

https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft.yaml

Issue 3. FeedReader also has upstream meson build features, so I pulled those in and tried using snapcraft’s meson plugin for a yaml here. But it fails with gcc, glibc, and zlib issues:

/snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37)
  /snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37)
  /snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libpng16.so.16)
  /snap/feedreader/x1/usr/bin/feedreader: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18)

https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft-meson-version.yaml

Revision history for this message
Hayden (anoncoward8348) wrote :

The snapcraft.yaml is here https://github.com/sirredbeard/FeedReader/commit/71b0c6757e1d5b9b0b4bc91a4d0ab0675517eee4

Most recent version: https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft.yaml

The make files generated by cmake build the web extension and whole project just fine.

Revision history for this message
Hayden (anoncoward8348) wrote :

The make file for that submodule, WebExtension, also builds fine.

Revision history for this message
Hayden (anoncoward8348) wrote :

I have a snapcraft building well by calling cmake from override-build instead of using the cmake plugin.

However, none of the files installed in part "feedreadercode" are coming over, despite being listed in prime.

Revision history for this message
Hayden (anoncoward8348) wrote :

I have two versions of this snapcraft.

The first is based on override-build on the cmake version

It fails because none of the files built in build come over to staging or prime.

https://github.com/sirredbeard/FeedReader/edit/master/snap/snapcraft.yaml

The second is based on a meson version using snapcraft's meson plugin:

https://github.com/sirredbeard/FeedReader/blob/master/snap/snapcraft-meson-version.yaml

It builds and installs but then when I try to run it:

# hayden@pop-os:~/Documents/Projects/FeedReader$ snap run feedreader
# /snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37)
# /snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37)
# /snap/feedreader/x1/usr/bin/feedreader: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libpng16.so.16)
# /snap/feedreader/x1/usr/bin/feedreader: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /snap/feedreader/x1/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18)

Hayden (anoncoward8348)
description: updated
description: updated
summary: - Snapcraft not handling cmake nested builds
+ Snapcraft not handling cmake nested builds and behaving unexpectedly
Hayden (anoncoward8348)
summary: - Snapcraft not handling cmake nested builds and behaving unexpectedly
+ Snapcraft not handling cmake nested builds, not including build script
+ files in snap, and dependency issues with meson builds
Revision history for this message
Hayden (anoncoward8348) wrote :

snapcraft, version 2.41+18.4.2

Hayden (anoncoward8348)
description: updated
Revision history for this message
Hayden (anoncoward8348) wrote :

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.

If I run into any issues, I will open a separate bug ticket. Thank you.

Changed in snapcraft:
status: New → Incomplete
Changed in snapcraft (Ubuntu):
status: New → Incomplete
Hayden (anoncoward8348)
Changed in snapcraft (Ubuntu):
status: Incomplete → New
Changed in snapcraft:
status: Incomplete → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.