Building my first flatpak

the error mean there is no branch master.

You probably want main and not master

Thank you both; you are correct.
Being a newb at so many of the *nix basics makes it a very steep hill.
FWIW, one of my main goals is to wean myself of WIN (again) - it almost seems to be like breaking a bad habit :slight_smile:

1 Like

Fixed the relevant line in the flmklife.sh to ‘branch: main’
which gets me past the issue and now things stop with

Switched to branch 'main'
Error: module: life: Can't find CMakeLists.txt

Seems I need to update my project code or give the flatpak-builder more information

Looking at your repo via GitHub - tester0077/flcmlife: Test code for flatpak creation of the wxWidgets Life demo using Cmake-Ninja build for linux it seems like there only is a .tar.gz file, which I don’t think is something that cmake should/would pick up on it’s own. Maybe you did add this by mistake.

Not by mistake but by ignorance :wink:
Can you please tell me what other file(s ) I need to add?

Is there a way to get a more detailed debug output or is there a more verbose log I might find and look through?

I tried the -v flag for the builder. but it does not seem to improve the data available for analysis by much :frowning:

not really a cmake guy, but I would have thought that you need a CMakeLists.txt Writing CMakeLists Files — Mastering CMake

And an archive is probably not really helpful without unarchiving it, but you might be doing that in your manifest

My manifest file:

#!/bin/bash

# Install flatpak-builder - already installed on Mint
#sudo apt -y install flatpak-builder


# Create Manifest file
cat > org.cmlife.cmlife.yml  <<EOL
app-id: org.cmlife.cmlife
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: life
#rename-icon: life
#rename-desktop-file: life.desktop
#finish-args:
#  - --socket=fallback-x11
#  - --socket=wayland
#  - --share=ipc
#  - --filesystem=xdg-documents
#  - --env=PWS_HELPDIR=/app/share/passwordsafe/help/

modules:
# Note: the order of modules is important as the builder works its way
# in a linear fashion - any dependencies need to be satisfied when 
# the process tries to build a module

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  - name: life
    #buildsystem: cmake-ninja
    buildsystem: cmake
    
    sources:
      - type: git
        url: https://github.com/tester0077/flcmlife.git
        branch: main
EOL

# Build flatpak
flatpak-builder -v --force-clean build-dir --disable-cache org.cmlife.cmlife.yml

supposedly downloads and extracts the data from Github and it does contain a CMakeLists.txt file, but it looks like flatpk-builder unarchives the gz file, but cannot find the CMakeLists.txt file.

While I am debugging this process, I force flatpak builder to restart without the cache, which makes things a bit slower, but hopefully does not cause issue because of leftovers from earlier trials.
The tail end of the build output:


FB: unmounting rofiles-fuse /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-JQ5n4d
Committing stage build-wxwidgets to cache
FB: Running: git rev-parse main
FB: Mounting read-only fs: rofiles-fuse /home/user/Public/flatpak/flcmlife/flatpak/build-dir /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-JQ5n4d
========================================================================
Building module life in /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/build/life-4
========================================================================
FB: Running: cp -al /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/git/https_github.com_tester0077_flcmlife.git /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/build/life-4/.git
FB: Running: git config --bool core.bare false
FB: Running: git checkout main
Switched to branch 'main'
FB: Running: git rev-parse --verify --quiet main:.gitmodules
Error: module: life: Can't find CMakeLists.txt
FB: Unmounting read-only fs: fusermount -uz /home/userPublic/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-JQ5n4d
user@CarboMint:~/Public/flatpak/flcmlife/flatpak$

When I download the archive directly I can find the CMakeLists.txt file in the root.
Evidently, Flatpak Builder either fails in the download, the unpacking, or looks in a different place but I don’t know enough to find out where the unpacking happens, if it happens.
Since there are no clear error messages to confirm or exclude any such errors, I am totally lost.

I don’t think it unarchives.

Usually, you don’t upload zip files to git repositories. So type git just pull that repo and does nothing with it, but the build system will try to find a cmake file, which isn’t there.

Youc could use type:archive and directly link the url to your github file, but not sure that’s better. I would prefer just pushing the unarchived contents into the git repo.

There is no CMakefile.txt there

Thank you both; you are both correct.
But, that still leaves me confused.
Using a type: archive fails because the sha256 checksum seems to change every time the gz is downloaded.
So I guess I’ll try a plain git as my next try.

that shouldn’t be the case, unless you changed the file.

Then again, I’ve seen github get sha values wrong/rewrite them, but that was on the releases page.

The sha checksum changing seems to be by design. See: Reddit - Dive into anything

I will likely have to put this on the back burner for a bit. It is just too time consuming to almost have to reverse engineer this process :hot_face:
But thank you all for sticking with me to this point :+1:

Well, here I am back at it again.
Mainly because I stumbled over a different approach, one which I had been wishing for al along: using my local project code, rather than uploading it to github or …
My current manifest:

app-id: org.cmlife.cmlife
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: life
#rename-icon: life
#rename-desktop-file: life.desktop
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --share=ipc
#  - --filesystem=xdg-documents
#  - --env=PWS_HELPDIR=/app/share/passwordsafe/help/

modules:
# Note: the order of modules is important as the builder works its way
# in a linear fashion - any dependencies need to be satisfied when 
# the process tries to build a module

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  - name: life
    buildsystem: cmake
    
    sources:
      - type: "dir"
        path: "../"

It seems to run and compile the test app, but complains about no ‘install’ step

*.... make install*
*make: *** No rule to make target 'install'.  Stop.*
*Error: module life: Child process exited with code 2*
*FB: Unmounting read-only fs: fusermount -uz /home/user/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-JQ5n4d*
*.... /Public/flatpak/flcmlife/flatpak$*

I have looked at several cmake buildsystem manifests, but cannot figure out how to fix that ‘install’ complaint.

Trying to run the app with:
flatpak run org.cmlife.cmlife
error: app/org.cmlife.cmlife/x86_64/master not installed

Not sure, we will be able to help, without seeing the other files involved (not that I know CMake)

These files are the same as those in the tar.gz file.
They are located in the parent directory from where the shell script - which also creates the manifest - is executed.

I’ll have to investigate what the install target is to contain and where flatpak expects the final executable to be ‘installed’.

I now have added an install target to my base CMakeLists.txt file but I still get errors and nothing is installed.

When I run --show-manifest, I get a warning, but don’t know how to fix things, nor whether it is related to my problems:

(flatpak-builder:76207): Json-WARNING **: 10:50:57.244: Failed to deserialize “config-opts” property of type “GStrv” for an object of type “BuilderModule”
{
“id” : “org.cmlife.cmlife”,
“runtime” : “org.freedesktop.Platform”,
“runtime-version” : “22.08”,
“sdk” : “org.freedesktop.Sdk”,
“command” : “life”,
“modules” : [
{
“name” : “wxwidgets”,
“sources” : [
{
“url” : “https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2”,
“sha256” : “dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02”,
“x-checker-data” : {
“type” : “anitya”,
“project-id” : 5150,
“stable-only” : true,
“url-template” : “https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2
},
“type” : “archive”
}
]
},
{
“name” : “life”,
“buildsystem” : “cmake”,
“sources” : [
{
“path” : “…/”,
“type” : “dir”
}
]
}
],
“finish-args” : [
“–socket=fallback-x11”,
“–socket=wayland”,
“–share=ipc”
]
}

According to flatpak-builder: document that cmake requires -DCMAKE_INSTALL_PREFIX=/app · Issue #546 · flatpak/flatpak · GitHub
I have added the install target

install( TARGETS life CONFIGURATIONS release DESTINATION /app/usr/bin )

What the destination ought to be I can’t sort out and I have tried several options from
/usr/bin
usr/bin
/app – see: flatpak-builder: document that cmake requires -DCMAKE_INSTALL_PREFIX=/app · Issue #546 · flatpak/flatpak · GitHub

The 'install related output is:

Install the project...
-- Install configuration: ""
FB: unmounting rofiles-fuse /home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz
Committing stage build-life to cache
Cleaning up
FB: Mounting read-only fs: rofiles-fuse /home/arnold/Public/flatpak/flcmlife/flatpak/build-dir /home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz
FB: unmounting rofiles-fuse /home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz
Committing stage cleanup to cache
Finishing app
FB: Mounting read-only fs: rofiles-fuse /home/arnold/Public/flatpak/flcmlife/flatpak/build-dir /home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz
Error: Command 'life' not found
FB: Unmounting read-only fs: fusermount -uz /home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz

It seems FB expects the output executable to be placed into:

/home/arnold/Public/flatpak/flcmlife/flatpak/.flatpak-builder/rofiles/rofiles-qF4aEz

but nothing ever shows up there.
Seems I am a bit further along, but again, I am stuck without a clue as to what FB is doing, why or how to fix it. :frowning:

Do you actually have an executable named life at the end of the build, you should be able to see it in the .flatpak-builder folders.

Your log errors out on that file not being there, as you configured “command” : “life”, to be your entry point.

At some point I definitely did, but still got the same error message.
Right now, after trying to verify what flatpak was really complaining about in its cryptic and opaque messages - even with the -v &/or --verbose options, I have other error messages.

As a result, I am thoroughly disappointed and defeated by this ‘software’.

Yeah, if you don’t have a file with that name, it will error.