1

I'm trying to create snap package of a Qt/QML application, the application is packaged well, when I try to run it I get /snap/swipe-app/x2/bin/qt5-launch: 74: exec: application: not found error.

here's my snapcraft.yaml file

name: swipe-app # you probably want to 'snapcraft register <name>'
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: description
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
  swipe-app:
    command: qt5-launch application
    plugs:
      - unity7
      - home

parts:
  application:
     # See 'snapcraft plugins'
    plugin: qmake
    project-files: ["snap.pro"]
    source: .
    build-packages:
      - qtbase5-dev
    stage-packages:
      # Here for the plugins-- they're not linked in automatically.
      - libqt5gui5
           after: [qt5conf] # A wiki part
Junius L
  • 15,881
  • 6
  • 52
  • 96
  • In my experience, you need more than just one Qt library when you are running. Have you tried running 'ldd' on the executable? – jwernerny Apr 13 '18 at 15:42

1 Answers1

0

As you have told the launch script that your program is called application then it will try to execute application from the current working directory when you run your snap. There are two things to note here:

The working directory is preserved from the terminal outside the snap context. For example if you are in your home directory /home/your-user then the working directory for swipe-app will also be /home/your-user.

As the working directory above is your home directory then commands without any anchor, such as application, will try to execute in your home directory. So in your example the launch script will attempt to run the command equivalent of /home/your-user/application.

You can fix this by either ensuring that the launch script executes a cd to change the working directory, e.g. cd $SNAP; or anchor your command by adding an achor, e.g. command: qt5-launch $SNAP/application.

Another thing you might need to check is that your qmake build actually outputs a binary called application. If you have not set TARGET= in your snap.pro project file then the binary will default to being called snap, not application. The line should read TARGET=application to make a binary called application: (ref: https://doc.qt.io/qt-5/qmake-variable-reference.html#target).

Lucy Llewellyn
  • 1,011
  • 6
  • 5