Helloword with meson

Hi all,

After following the create-your-first-snap tutorial, I am now trying to use meson rather than autotools. My program compiles correctly with meson, but with snapcraft I get this error:

“Failed to generate snap metadata: The specified command ‘bin/hello’ defined in the app ‘hello’ does not exist. Ensure that ‘bin/hello’ is installed with the correct path.”

Can you tell me how to configure the installation path?

snapcraft.yaml

name: hello-meson
base: core18
version: '2.10'
summary: hello world snap with meson
description: |
  hello world snap with meson
grade: devel
confinement: strict

apps:
  hello:
    command: bin/hello

parts:
  gnu-hello:
    source: src
    plugin: meson

meson.build

project('hello-meson', 'c')
executable('hello', 'hello.c')

Thanks in advance

parts:
  gnu-hello:
    meson-parameters:
    - --prefix=/

or use the parts.<part-name>.organize feature

Thanks kotyk, I tried your solution, but I have the same problem. But by modifying the meson.build like this, it works:

project('hello-meson', 'c')
executable('hello', 'hello.c', install : true, install_dir : 'install/bin')
1 Like