Linking error in snapcraft build with Gnome 3-34, but no with 3-28

Hi,
Recently I pushed some changes with decoding audio and zip to my project - https://github.com/qarmin/czkawka/commit/cc8d42e0ff40db849624fc5eee84a58ce80ab1ef

CI on Ubuntu 18.04, Windows and MacOS passes, but since this time I have a linking error in automatic and manual snap builds for every architecture(before this commit everything works fine):

Compiling czkawka_gui v2.3.0 (/build/czkawka/parts/czkawka/build/czkawka_gui)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/build/czkawka/parts/czkawka/build/target/release/deps/czkawka_gui-fbcaafd901f8e257.czkawka_gui.2um25u2j-cgu.0.rcgu.o" "/build/czkawka/parts/czkawka/build/target/release/deps/czkawka_gui-fbcaafd901f8e257.czkawka_gui.2um25u2j-cgu.1.rcgu.o" "/build/czkawka

... A lot of characters later

gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-3f953ad652ab829a.rlib" "-Wl,-Bdynamic" "-lasound" "-lgtk-3" "-lgdk-3" "-lz" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-latk-1.0" "-lcairo-gobject" "-lcairo" "-lgdk_pixbuf-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-latk-1.0" "-lgdk-3" "-lz" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lpango-1.0" "-lgobject-2.0" "-lglib-2.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lglib-2.0" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"

  = note: /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_font_get_hb_font'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_blob_create_from_file'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_coverage_get_type'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_font_description_get_variations'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_ot_tags_from_script_and_language'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0: undefined reference to `atk_component_scroll_to_point'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0: undefined reference to `atk_object_get_accessible_id'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0: undefined reference to `atk_text_scroll_substring_to_point'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_ot_metrics_get_position'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `pango_font_description_set_variations'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_ot_layout_script_select_language'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0: undefined reference to `atk_text_scroll_substring_to'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_ot_var_named_instance_get_design_coords'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0: undefined reference to `atk_component_scroll_to'
          /snap/gnome-3-34-1804-sdk/current/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined reference to `hb_ot_var_get_axis_infos'
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

I know that it looks at my fault, but It is really strange that in CI everything works fine, but in Snapcraft there are linking errors with Gnome SDK(I suspect that this SDK is reason why Czkawka doesn’t compile).

This is due to you using the gnome-3-34 extension. I really wish that the desktop team would stop publishing these extensions of gnome that use library versions that are not in ubuntu 18.04 etc. By their publishing and encouraging the use of the non-standard libraries snap authors, like yourself, are under the belief that it will work fine. Unless the desktop team recompiles the whole universe against these non-standard libraries we will continue getting issues like this where a library required for a snap is compiled against a library in stock ubuntu but the extension has changed that with an incompatible version. This WILL lead to segfaults!

In this particular case, the problem seems to be down to these lines in the snapcraft.yaml file:

    stage-packages:
      - libgtk-3-dev

This will pull a lot of libraries (and headers too, which probably aren’t used) into the snap that would otherwise be provided by the platform snap (whether it is the 3.28 or 3.34 variant).

It only causes problems with the 3.34 platform snap because of the version skew, but is undesirable in both cases.

1 Like