Unknown target install

I am using the cmake plugin and am getting stuck at at the install section. I believe it is because the git I am trying to snap uses a python script to complete the build. I have successfully followed many tutorials and this is my first go at packing something outside of a tutorial.

I am sure there is more information I can/need to share but not sure what will help or how to get it posted.

Thanks in advance.

Hi, welcome to the Snapcraft community :slight_smile:

If the python script is called as part of the cmake build then should work correctly, unless it’s using any hardcoded paths that require changing. Otherwise if the build instructions tell you as the builder to execute the python script you might find that you can do so with an override-build script:

parts:
  your-part:
    ...
    override-build: |
      snapcraftctl build # do the normal cmake plugin's build stuff
      python3 some-install-script.py

You will need to check the some-install-script.py to see if it is using hard coded paths or if you can override the install location - you can use $SNAPCRAFT_PART_INSTALL environment variable to access the dynamic installation path from snapcraft.

If you’re still stuck and can share your work in progress and the app’s source, the experts can try to have a poke for you to see what’s up.

I am still stuck. I may be in a bit over my head. lol

here is my snapcraft.yaml as it is now:

name: retrofe
base: core20
version: git
summary: RetroFE is a cross-platform frontend designed for MAME.
description: |
  RetroFE is a cross-platform frontend designed for MAME.

grade: devel
confinement: devmode
parts:
  retrofe:
    # See 'snapcraft plugins'
   plugin: cmake
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DVERSION_MAJOR=0
      - -DVERSION_MINOR=0
      - -DVERSION_BUILD=0
    cmake-generator: Ninja
   override-build: |
      snapcraftctl build # do the normal cmake plugin's build stuff
      python3 Package.py --os=linux --build=full
    source: .
    source-subdir: RetroFE/RetroFE/Source
    build-packages:
      - git
      - g++
      - dos2unix
      - libsdl2-dev
      - libsdl2-ttf-dev
      - libsdl2-image-dev
      - libsdl2-mixer-dev
      - zlib1g-dev
      - libgstreamer1.0-dev
      - libgstreamer-plugins-base1.0-dev
      - libgstreamer-plugins-good1.0-dev
      - libglib2.0-dev
      - sqlite3

The source is: https://github.com/cgethycx/RetroFE

The install script is hiding in the RetroFE/Scripts folder.

There is obviously still a lot that needs to be done but this is how far i have gotten. :slight_smile:

how exactly ? what error do you hit etc etc ?

Sorry, Still the same error.

[50/50] Linking CXX executable /root/parts/retrofe/src/RetroFE/RetroFE/Build/retrofe
+ DESTDIR=/root/parts/retrofe/install
+ cmake --build . --target install
ninja: error: unknown target 'install'
Failed to build
'retrofe'.                                                                                                                                                                                        
Recommended resolution:                                                                                                                                                 
Check the build logs and ensure the part's configuration and sources are correct.

I am also not sure where to look for the build logs.

If it helps, the Package.py is only used to copy resource files and folders along with the binary all in to the same folder.

The app seems to build fine but just gets stuck in the build folder and nothing gets moved to the install folder when trying to create the snap.

Some but not all of the folders could be packed with the snap while others will be used for user content.

I watched most of the Snapcraft Live videos and I believe I do not need to run the Package.py as I know what folders are needed, but I have not been successful following the guide lines because the install process has not completed.

I also have no problem building and running the app and may need to take a different snap build method such as dump but I am not sure I understand that method any better.

That suggests that the CmakeLists.txt doesn’t supply the installation instructions. I think for this project you might need to use override-build but do not call snapcraftctl build in the script; instead, you need to replicate the plugin’s behaviour yourself. This is not normally required but it seems that the project you’re snapping is unusual.

Something like this might work:

parts:
  your-part:
    ...
    override-build: |
      cmake -DCMAKE_INSTALL_PREFIX=/usr -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0 $SNAPCRAFT_PART_SRC
      cmake --build .
      ... # your installation steps here
1 Like