Developing chiaki-ng updates on Steam Deck¶
This is for contributors that want to make/test updates to the codebase without building a new flatpak each time.
Adding Dependencies
If you want to add new dependencies that aren't already included in the flatpak modules or SDK, then you will need to create a new flatpak build adding that module or install the module locally and it to your PATH. However, this would only be needed in rare circumstances.
Setup Environment¶
-
Install flatpak with debug extension and/or build a new one with any added dependencies following Building the Flatpak Yourself
flatpak install --user --include-debug -y https://raw.githubusercontent.com/streetpea/chiaki-ng/main/scripts/flatpak/io.github.streetpea.Chiaki4deck-devel.flatpakref
Creating local flatpak builds
If you want to create flatpak builds from local files, you can do this by changing the manifest sources from:
sources: - type: git url: https://github.com/streetpea/chiaki-ng.git branch: main
to:
sources: - type: dir path: path-to-chiaki-ng-git
-
Copy config file from chiaki-ng
cp ~/.var/app/io.github.streetpea.Chiaki4deck/config/Chiaki/Chiaki.conf ~/.var/app/io.github.streetpea.Chiaki4deck-devel/config/Chiaki/Chiaki.conf
-
Install the SDK
flatpak install --user org.kde.Sdk//6.8
-
Install the
Debug
extensions for the SDKflatpak install --user org.kde.Sdk.Debug//6.8
-
Clone the project onto your Steam Deck with:
git clone --recurse-submodules https://github.com/streetpea/chiaki-ng.git
git clone --recurse-submodules git@github.com:streetpea/chiaki-ng.git
gh repo clone streetpea/chiaki-ng
What if I'm testing changes from my branch?
Clone that branch or pull it into the git repo cloned above
Creating and Debugging Builds without New Flatpak Build¶
-
Enter the development version of the flatpak with the chiaki-ng source code mounted with:
flatpak run --command=bash --devel io.github.streetpea.Chiaki4deck-devel
-
Create a build using cmake as per usual
- Change into the git directory for your cloned project
-
Make a directory for your debug build
mkdir Debug
-
Change into debug directory
cd Debug
-
Create build files with cmake
cmake -DCMAKE_BUILD_TYPE=Debug ..
-
Build
chiaki-ng
make
- Change into the git directory you mounted
-
Make a directory for your debug build
mkdir Release
-
Change into debug directory
cd Release
-
Create build files with cmake
cmake -DCMAKE_BUILD_TYPE=Release ..
-
Build
chiaki-ng
make
-
Run build as usual from executables (using gdb for debugging Debug build)
From
Debug
directory using gdb:gdb ./gui/chiaki
From
Release
directory:./gui/chiaki
Set vaapi to none
When running chiaki from within the flatpak like this please set vaapi to none as otherwise the video won't work. This is fine since you are just running Chiaki like this for development tests only so worse performance isn't a big concern.
-
Make edits to the source code to implement your changes
Editing code on Steam Deck
Personally, I use vscode which you can install as a flatpak from Discover. You can open your chiaki code directory using vscode from your Steam Deck desktop and save changes. Then, these changes which will be reflected in your flatpak (since you mounted the chiaki code directory to your flatpak in the steps above) when you do a new build in your flatpak environment. The process would be similar with other code editors installed on your Steam Deck.
-
After making changes to the source code, simply rebuild with make as per usual
Debug Coredump From a flatpak¶
-
Get process from coredump
-
Run coredumpctl
coredumpctl
-
Get pid for your application from list
-
-
Open gdb session for your flatpak with the given pid
flatpak-coredumpctl -m given_pid flatpak_name
Example given pid 4822 and flatpak name
io.github.streetpea.Chiaki4deck-devel
flatpak-coredumpctl -m 4822 io.github.streetpea.Chiaki4deck-devel
-
Use gdb commands as per usual such as
bt full
For a comprehensive guide on gdb commands see Debugging with GDB