Waybar snap for ubuntu: need help troubleshooting dependencies

Hello all I am trying to build a waybar snap for ubuntu sway but I am running into dependency issues and I would appreciate any assistance. I am still rather new to building snaps and my background is not in software dev so I may have made a number of silly mistakes…

I am currently stuck at with an error about libffi not being found but I am sure there will be a number of other problems to follow.

undefined reference to symbol ‘ffi_type_void@@LIBFFI_BASE_8.0’ ‘’’

Here is the yaml file for the snap.

name: waybar # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Wayland bar for Sway. # 79 char long summary
description: |
  Highly customizable Wayland bar for Sway and Wlroots based compositors.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
    build-deps:
        plugin: nil
        build-packages:
        - ninja-build
        - pkg-config # needed for the build to find wayland-client
        - libboost-filesystem-dev
        - libfreetype6-dev
        - libwayland-dev
        - libxkbcommon-dev
        - g++
        - make
        - libffi8
        - libffi-dev

    waybar:
        source: https://github.com/Alexays/Waybar.git
        source-type: git
        source-tag: "0.9.16"
        plugin: meson
        stage-packages:
        - libffi8
        - libffi-dev
        - gobject-introspection
        - libharfbuzz-bin
        - libxkbregistry-dev
        - libgtkmm-3.0-dev
        - libfreetype6
        - fonts-freefont-ttf

apps:
    waybar:
        command: /usr/local/bin/waybar
        plugs:
        - x11
        - wayland

Hi, I use Waybar with Mir so I would also interested in this snap.

I’m not clear when your problem arises: when you build the snap? Or when you run it?

Now, some observations on your snapcraft.yaml

  1. The build-deps stanza doesn’t look like it is what you mean. I think you want the build-packages attribute in your waybar part instead.
  2. waybar has -dev packages in stage-packages, I don’t think these will be needed at runtime.
  3. You will almost certainly need a graphics stack (OpenGL?) at runtime
  4. You probably need to set environment variables or use layouts for things like fonts to be located

If you’re willing to use base: core20 for the moment, then you can probably follow this examples:

(I know it says “IoT”, but waybar has a similar interaction with the Wayland server)

If you follow this approach, you won’t be stuck on core20 indefinitely: Updating these tutorials for core22 will happen soon, but things that need to be put in first. (It will be a few weeks)

thanks for the quick reply. I moved to core22 because I couldn’t figure out what I should use in place of libxkbregistry-dev. I dont see an option for anything before 21.

I will test the corrections and get back to you with the new error.

FWIW I often run Waybar from the upstream on Ubuntu, and have scripted its install. This script looks a little odd cos there are a lot of repeated deps for each package, but the idea was to have each one standalone - it might be a useful reference for you: https://github.com/jnsgruk/dotfiles/blob/0c7373e23e3b6a40303c58cd8fea4dffc0dd3c5d/scripts/install-packages-sway#L54-L88

EDIT: this is tested on Ubuntu 22.04 - so should be fine for core22

Success. I think the big fixes were:

  • using waybar 0.9.0 which works with core20
  • using the snapcraft extension for gnome to do all the dirty work in setting variables and such
  • when using core20, it provides a neat summary of the missing packages that I could copy and paste into the yaml

The bar runs with the ubuntu sway waybar.sh script and detects my config file. It is really ugly though and none of the fontawesome icons are displayed, so there is still some work to be done. I just need this to work on my pc so I dont think I will try to make it snap store ready anytime soon, but any more advice would be welcomed.

https://gitlab.com/RJDaniels/snap_waybar.git

Thanks for the advice. In the end I think the issue was that I wasn’t using the correct version for core20.

Update for those interested:

I have started working on making the snap somewhat more official. If anyone would like to give it a try, you can get it from my gitlab (link above) or from here:

I have managed to get it to work in strict mode, the plugins for the system monitor tools seem to be working (cpu monitor, ram monitor, battery monitor, internet info, time and date). Some apps get their tray indicator in without any issues (solaar) but others seem to need some work (stretchly snap). I know that mpd(?) isnt working with the snap at the moment but I dont use the waybar for media so I dont think I will be troubleshooting that any time soon.

I still have not got the fontawesome icons to display which is as shame, cos it is the biggest detraction from an otherwise good looking snap.

1 Like