Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building your first Flatpak doesn't work #230

Open
raffaem opened this issue Mar 25, 2021 · 3 comments · May be fixed by #423
Open

Building your first Flatpak doesn't work #230

raffaem opened this issue Mar 25, 2021 · 3 comments · May be fixed by #423
Labels

Comments

@raffaem
Copy link

raffaem commented Mar 25, 2021

first-build.rst is bugged.

This command will build each module that is listed in the manifest and install it to the /app subdirectory, inside the build-dir directory.

This is not true, there is no /app subdirectory inside build-dir

  1. flatpak-builder --user --install build-dir org.flatpak.Hello.yml
    doesn't work. Error is as follows:

App dir 'build-dir' is not empty. Please delete the existing contents or use --force-clean.

Using --force-clean doesn't work either

$ flatpak-builder --user --install build-dir org.flatpak.Hello.yml --force-clean
Emptying app dir 'build-dir'
Downloading sources
Starting build of org.flatpak.Hello
Cache hit for hello, skipping build
Cache hit for cleanup, skipping
Cache hit for finish, skipping
Everything cached, checking out from cache
Exporting org.flatpak.Hello to repo
Commit: <REDACTED>
Metadata Total: 9
Metadata Written: 1
Content Total: 3
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Installing app/org.flatpak.Hello/x86_64/master
Error: Failed to install org.flatpak.Hello: While pulling app/org.flatpak.Hello/x86_64/master from remote hello-origin: opening repo: opendir(<REDACTED>/flatpak/Building%20your%20first%20flatpak/.flatpak-builder/cache): No such file or directory
Install failed: Child process exited with code 1
@danielquinn
Copy link

I ran into this today and had another problem as well. The original line:

$ flatpak-builder build-dir org.flatpak.Hello.yml

fails with the message:

error: org.freedesktop.Sdk/x86_64/20.08 not installed
Failed to init: Unable to find sdk org.freedesktop.Sdk version 20.08

It seems to be a constant in the docs that merely specifying org.freedesktop.Sdk in your manifest is enough for flatpack-builder to know that it needs to download and install it for you, but that doesn't happen so you're left to guess what the right course of action is. I managed to figure out that I needed to flatpak install org.freedesktop.Sdk at which point @raffaem's error hit me and I thought it worthwhile posting a bug.

I don't know what the correct behaviour is, otherwise I'd issue a PR to fix the docs. If someone can answer my questions I'm happy to offer a fix for the docs as a PR:

  1. Should flatpak-builder automatically be downloading SDKs? If yes, then that sounds like a bug in flatpak-builder. If no, then I can amend the docs.
  2. What's the right way to install a built-but-not-installed package? Using --force-clean effectively means that you're not using your last build, which can be frustrating for people who just want to fix a typo, but if that's the official way to do it, then we should at least cover that in the docs. In my case --force-clean worked as expected, so I can't reproduce @raffaem's error in that case.

@TingPing
Copy link
Member

I managed to figure out that I needed to flatpak install org.freedesktop.Sdk

This is Step 1 on that page: https://docs.flatpak.org/en/latest/first-build.html#install-a-runtime-and-the-matching-sdk

Should flatpak-builder automatically be downloading SDKs? If yes, then that sounds like a bug in flatpak-builder. If no, then I can amend the docs.

No, but you can pass --install-deps-from=flathub.

sing --force-clean effectively means that you're not using your last build, which can be frustrating for people who just want to fix a typo, but if that's the official way to do it, then we should at least cover that in the docs.

Build dir != cache dir. This is not a problem.

@danielquinn
Copy link

Build dir != cache dir. This is not a problem.

...but it is a problem, because the documentation when followed verbatim results in an error message that isn't explained in the documentation. The docs say that you should first build your flatpak:

$ flatpak-builder build-dir org.flatpak.Hello.yml

and the very next code fragment says to install your flatpak with this:

$ flatpak-builder --user --install build-dir org.flatpak.Hello.yml

Executing these two commands in order results in an error:

App dir 'build-dir' is not empty. Please delete the existing contents or use --force-clean.

Either the docs should predict or at least explain this error, or they should tell the user to (a) delete the build-dir in advance (with an explanation) or (b) tell the user to include --force-clean. At least then you don't have a user wondering why the official documentation for a Hello World fails on step 5 of 8.

As for the bit about needing to install the Sdk. Sorry about that, I must have had this page confused with the multitude of other pages that don't make it clear that you need to download these files first. Maybe the solution here is a better error message? Something like

Failed to init: Unable to find sdk org.freedesktop.Sdk version 20.08.
You might try looking for it on flathub with:

    $ flatpak install flathub org.freedesktop.Sdk//20.08

@bbhtt bbhtt linked a pull request Dec 16, 2023 that will close this issue
@bbhtt bbhtt added the bug label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants