Cant build qt app with core18. snapcraft duplicate -DCMAKE_INSTALL_PREFIX flag

it seems that the snapcraft duplicates -DCMAKE_INSTALL_PREFIX in final build command idk why snapcraft.yaml

name: textreader # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Read text using online/offline services # 79 char long summary
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: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots


parts:
  textreader:
    # See 'snapcraft plugins'
    source: .
    stage-packages:
    - curl
    plugin: cmake
    configflags:
    - "-DKDE_INSTALL_USE_QT_SYS_PATHS=ON"
    - "-DCMAKE_INSTALL_PREFIX=/usr"
    - "-DCMAKE_BUILD_TYPE=Release"
    - "-DENABLE_TESTING=OFF"
    - "-DBUILD_TESTING=OFF"
    - "-DKDE_SKIP_TEST_SETTINGS=ON"


apps:
  textreader:
    command: usr/bin/textreader
    extensions: [kde-neon]
    plugs:
    - network
    - network-bind

error:

Failed to run 'cmake /root/parts/textreader/src -DCMAKE_INSTALL_PREFIX= -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DBUILD_TESTING=OFF -DKDE_SKIP_TEST_SETTINGS=ON' for 'textreader': Exited with code 1.
Verify that the part is using the correct parameters and try again.

It doesn’t matter that you have multiple -DCMAKE_INSTALL_PREFIX= flags. my actual problem was a build dependency. I found it thanks to snapcraft --debug. and added to build-packages: and everything worked correctly.

1 Like