Trying to create a snap for Viber

Viber is current distributed as a closed-source .deb package for Ubuntu.

Here is my (UPDATED: second) attempt to repackage it as a snap package.

name: viber-unofficial
version: '0.1'
summary: Free and secure calls and messages to anyone, anywhere
description: | 
  Authentic conversations, the way you like them
  Deepen your relationships with Viber’s wide range 
  of communication features.
  This is an unofficial snap package for Viber based on viber.deb


grade: stable
confinement: strict

apps:
  viber:
    command: desktop-launch $SNAP/opt/viber/Viber
    plugs:
     - x11
     - desktop
     - desktop-legacy
     - wayland
     - unity7
     - network-bind
     - network-observe
     - home
     - opengl
     - gsettings

parts:
  viber:
    plugin: dump
    source: http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
    source-type: deb
    after: [desktop-qt5]
    build-attributes: [keep-execstack]
    stage-packages: 
      - xdg-utils
      - libxss1
      - libpulse0

I am building now on Ubuntu 16.04 (in a LXD container, container image: ubuntu:16.04).
Here is the output,

$ snapcraft 
Preparing to pull desktop-qt5 
Hit http://archive.ubuntu.com/ubuntu xenial InRelease                          
Hit http://archive.ubuntu.com/ubuntu xenial-updates InRelease                  
Hit http://archive.ubuntu.com/ubuntu xenial-backports InRelease                
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease                
Fetched 0 B in 0s (0 B/s)                                                      
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease                
Hit http://archive.ubuntu.com/ubuntu xenial InRelease                          
Hit http://archive.ubuntu.com/ubuntu xenial-updates InRelease                  
Hit http://archive.ubuntu.com/ubuntu xenial-backports InRelease                
Fetched 0 B in 0s (0 B/s)                                                      
Pulling desktop-qt5 
Cloning into '/home/ubuntu/viber/parts/desktop-qt5/src'...
remote: Counting objects: 1142, done.
remote: Total 1142 (delta 0), reused 0 (delta 0), pack-reused 1142
Receiving objects: 100% (1142/1142), 188.26 KiB | 0 bytes/s, done.
Resolving deltas: 100% (597/597), done.
Checking connectivity... done.
'viber' has prerequisites that need to be staged: desktop-qt5
Preparing to build desktop-qt5 
Building desktop-qt5 
make FLAVOR=qt5 -j4
make FLAVOR=qt5 install DESTDIR=/home/ubuntu/viber/parts/desktop-qt5/install
install -D -m755 desktop-launch /home/ubuntu/viber/parts/desktop-qt5/install/bin/desktop-launch
install -D -m644 snappy-qt5.conf \
	/home/ubuntu/viber/parts/desktop-qt5/install/etc/xdg/qtchooser/snappy-qt5.conf
install -D -m644 snappy-qt4.conf \
	/home/ubuntu/viber/parts/desktop-qt5/install/etc/xdg/qtchooser/snappy-qt4.conf
install -D -m644 flavor-select /home/ubuntu/viber/parts/desktop-qt5/install/
Staging desktop-qt5 
Preparing to pull viber 
Hit http://archive.ubuntu.com/ubuntu xenial InRelease                          
Hit http://archive.ubuntu.com/ubuntu xenial-updates InRelease                  
Hit http://archive.ubuntu.com/ubuntu xenial-backports InRelease                
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease                
Fetched 0 B in 0s (0 B/s)                                                      
Get:1 libxss1_1.2.2-1_amd64.deb [8582 B]                                       
Fetched 8582 B in 0s (0 B/s)                                                   
Pulling viber 
Downloading 'viber.deb'[==================================================] 100%
Preparing to build viber 
Building viber 
Staging viber 
Priming desktop-qt5 
Priming viber 
The execstacks are going to be cleared for the following files:
- /home/ubuntu/viber/prime/opt/viber/lib/libQt5WebEngineCore.so.5
To disable this behavior set `build-attributes: [keep-execstack]` for the part.
Snapping 'viber-unofficial' |                                    
Snapped viber-unofficial_0.1_amd64.snap

When trying to run Viber, I get errors about missing libraries. It needs some additional tries to figure out the full list of missing libraries, so that I can add them to the staged package list in snapcraft.yaml.

Update: The following are the old error messages when trying to build the snap on 18.04. Still, do not know what I would get that issue but since snapcraft can create packages on 16.04, I am using that one.

Here is the error message when trying to build in a Ubuntu 18.04 LXD container (ubuntu:18.04 container image).

$ snapcraft 
Skipping pull desktop-qt5 (already ran)
Skipping build desktop-qt5 (already ran)
Skipping stage desktop-qt5 (already ran)
Skipping pull viber (already ran)
Skipping build viber (already ran)
Skipping stage viber (already ran)
Priming desktop-qt5 
The GLIBC version of the targeted core is 2.23. A newer libc will be required for the following files:
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/virtio_gpu_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/r600_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/r200_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/r300_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/lib/x86_64-linux-gnu/libbsd.so.0.8.7 (requires GLIBC 2.25)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.7 (requires GLIBC 2.25)
- /home/ubuntu/viber/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.7 (requires GLIBC 2.25)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/i965_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/i915_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0 (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/nouveau_vieux_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/radeon_dri.so (requires GLIBC 2.27)
- /home/ubuntu/viber/prime/usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so (requires GLIBC 2.27)
'libc6' is required inside the snap for this part to work properly.
Add it as a `stage-packages` entry for this part.

Ubuntu 18.04 comes with GLIBC 2.27. The message says that the core image has GLIBC 2.23.
The required versions of GLIBC as shown in the messages are 2.27 and also 2.25.

Awesome! I’d be inclined to build in a 16.04 LXD container. It builds and installs here, but complains that it’s missing libxss (and maybe others, I didn’t go any further).

It appears that you can include “libc6” in the stage-packages list to fix this?

Including libc yourself should be avoided at all costs. It will lead you down a deep hole that is dangerous and scary and there are no white rabbits to follow. Wonderland, that is not.

1 Like

I am in a twisty maze of rabbit-holes all alike.

So basicaly I need a 16.03 VM to make packages?

Currently, snap packages are targeting the Ubuntu 16.04 Core.
You can verify that with snap info core.

Which means that when you want to create a snap of a binary package, you would need to start off with Ubuntu 16.04. You can either create a 16.04 VM, or just use a LXD container with 16.04.
A LXD container is created in 1-2 seconds, a VM takes much more.

At some point, the core will be targetting 18.04 but for now it’s 16.04.

snapcraft has a feature to create this LXD container for you. But since there will be lots of trial&error, you can create the LXD container yourself.

I updated my (work-in-progress) snapcraft.yaml for Viber. Here is now the latest version.

name: viber-unofficial
version: '0.1'
summary: Free and secure calls and messages to anyone, anywhere
description: | 
  Authentic conversations, the way you like them
  Deepen your relationships with Viber’s wide range 
  of communication features.
  This is an unofficial snap package for Viber based on viber.deb


grade: stable
confinement: strict

apps:
  viber:
    command: desktop-launch $SNAP/opt/viber/Viber
    plugs:
     - x11
     - desktop
     - desktop-legacy
     - wayland
     - unity7
     - network-bind
     - network-observe
     - home
     - opengl
     - gsettings

parts:
  viber:
    plugin: dump
    source: http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
    source-type: deb
    after: [desktop-qt5]
    build-attributes: [keep-execstack]
    stage-packages: 
      - xdg-utils
      - libxss1
      - libpulse0
      - libasound2
      - libxtst6
      - libpulse-mainloop-glib0
      - libnss3

When I run this version (in a LXD GUI container), I get the following error:

/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5DBus.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/Viber)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Sql.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Sql.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Sql.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Concurrent.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Concurrent.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Multimedia.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Multimedia.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Multimedia.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Multimedia.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Multimedia.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Location.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Location.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Location.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Location.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Location.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebSockets.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebSockets.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebSockets.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebSockets.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngine.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngine.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngine.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngine.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5PrintSupport.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebEngineCore.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Quick.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebChannel.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebChannel.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5WebChannel.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Qml.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Qml.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Qml.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Network.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Qml.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Positioning.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Positioning.so.5)
/snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5_PRIVATE_API' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Positioning.so.5)

Now I am stuck at this point.

This : /snap/viber-unofficial/x1/opt/viber/Viber: /snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.9' not found (required by /snap/viber-unofficial/x1/opt/viber/lib/libQt5Concurrent.so.5) should mean that Viber requires Qt 5.9. When looking at the package installed “natively” in Ubuntu 16.04 with ldd /opt/viber/Viber I see:

    libQt5Core.so.5 => /opt/viber/lib/libQt5Core.so.5 (0x00007fb41ed9c000)

which seems to show that the app has a LD_LIBRARY_PATH refering to /opt/viber/lib before the standard OS paths. I think we’ll have to recreate that somehow. I’ll need to catch up with you in making the snapcraft file I think is the right one.

Relevant pages:

Native install:

$ patchelf --print-rpath /opt/viber/Viber
$ORIGIN:$ORIGIN/lib

inside the installed snap:

/snap/viber-bootleg/x4/opt/viber $ patchelf --print-rpath ./Viber 
$ORIGIN:$ORIGIN/lib

so the rpath is not edite. Since $ORIGIN denotes the binarys home directory it should be loading the dynamic libraries from the Viber package rather than the system directories:

Native install:

$ ldd /opt/viber/Viber | grep Qt
    libQt5Sql.so.5 => /opt/viber/lib/libQt5Sql.so.5 (0x00007f2ebf175000)
    libQt5Concurrent.so.5 => /opt/viber/lib/libQt5Concurrent.so.5 (0x00007f2ebf16f000)
    libQt5Multimedia.so.5 => /opt/viber/lib/libQt5Multimedia.so.5 (0x00007f2ebf060000)
...

but the paths become:

/snap/viber-unofficial/x1/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

which are the system library directories, not the viber package directories.

2 Likes

I managed to make it work with a few warnings. I added the dependencies of the deb package and the glib launcher to configure XDG. Here is my version.

name: viber
version: '0.1' 
summary: Single-line elevator pitch for your amazing snap 
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel 
confinement: devmode

parts:
  viber:
    plugin: dump
    source: viber.deb
    source-type: deb
    after: [desktop-glib-only]
    stage-packages:
      - libxss1
      - libssl1.0.0
      - libpulse0
      - libasound2
      - libnss3
      - libxcomposite1
      - libxcursor1
      - libxdamage1
      - libcurl3
      - libgstreamer-plugins-base1.0-0
      - libgstreamer1.0-0
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-pulseaudio
      - gstreamer1.0-libav
apps:
  viber:
    command: desktop-launch $SNAP/opt/viber/Viber
1 Like

I am using the following snapcraft.yaml (adapted from https://github.com/uglide/viber-unofficial-snap/blob/master/snapcraft.yaml).
I create it inside a Ubuntu 16.04 system container (hence, does not require to create a VM).

name: viber-unofficial
version: '10.3' 
summary: Unofficial snap for Viber Desktop
description: |
  Viber is a calling and messaging app that connects people–no matter who they are, or where they’re from.
  With a free and secure connection, over 1 billion users worldwide communicate with their loved ones 
  through high-quality audio and video calls, messaging, and much more. All Viber calls and chats are
  protected by built-in end-to-end encryption, so you can be sure that your conversations are always secure.

grade: stable
confinement: strict

parts:
  viber:
    plugin: dump
    source: http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
    source-type: deb
    after: [desktop-glib-only]
    stage-packages:
      - libxss1
      - libssl1.0.0
      - libpulse0
      - libpulse-mainloop-glib0
      - libasound2
      - libnss3
      - libxcomposite1
      - libxcursor1
      - libxdamage1
      - libcurl3
      - libgstreamer-plugins-base1.0-0
      - libgstreamer1.0-0
      - libsm6
      - libxi6
      - libxtst6
      - libxrandr2
      - libegl1-mesa
      - libxcb-xkb1
      - libxcb-render-util0
      - libxcb-xfixes0
      - libxcb-randr0
      - libxcb-image0
      - libxcb-keysyms1
      - libxcb-icccm4
      - libxcb-shape0
      - libxcb-util1
      - libpci3
      - gstreamer1.0-plugins-base
      - gstreamer1.0-plugins-good
      - gstreamer1.0-plugins-ugly
      - gstreamer1.0-pulseaudio
      - gstreamer1.0-libav
      - libdb5.3
      - libgpm2
      - libxslt1.1
apps:
  viber:
    command: desktop-launch $SNAP/opt/viber/Viber
    desktop: usr/share/applications/viber.desktop
    environment:
      LD_LIBRARY_PATH: $SNAP/opt/viber/lib:$LD_LIBRARY_PATH
    plugs: 
     - home
     - unity7
     - opengl
     - gsettings
     - network
     - network-bind
     - x11
     - desktop
     - desktop-legacy
     - pulseaudio
     - camera
    environment:
      DISABLE_WAYLAND: 1
      WAYLAND_DISPLAY: no-display
      QTCOMPOSE: $SNAP/usr/share/X11/locale 

I get the following error:

$ viber-unofficial.viber 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)

What could be the issue? Can I enable something to see more on what is going on?
As noted above, Viber comes with Qt libraries which should be included first, so that it does not use the system Qt libraries.

Well… In my case the problem definitely went away after adding desktop-launch to the command:. I’ve even dug up an old backup branch and backtracked my steps… But I see you already have that.

Here’s an idea (the only productive one that comes to mind for now…): try using an extension. Wither for gnome or KDE.

apps:
  viber:
  (...)
    extensions: [gnome-3-34]

(not sure about the 3-34 version, but you know… Try now, worry later! :smiley: )

or

apps:
  viber:
  (...)
    extensions: [kde-neon]

I think there’s a decent chance it will do the trick.