Skip to content

Instantly share code, notes, and snippets.

@perroboc
Last active May 22, 2025 15:41
Show Gist options
  • Save perroboc/e090a556d262c9775f88295bd4f6b361 to your computer and use it in GitHub Desktop.
Save perroboc/e090a556d262c9775f88295bd4f6b361 to your computer and use it in GitHub Desktop.
Build gamescope in Fedora 40

gamescope build on Fedora 40

These are my notes on how to build gamescope in Fedora 40

Install dependencies

sudo dnf install SDL2-devel cmake gcc gcc-c++ git glm-devel glslang google-benchmark-devel hwdata-devel libX11-devel libXcomposite-devel libXcursor-devel libXdamage-devel libXext-devel libXfixes-devel libXmu-devel libXrender-devel libXres-devel libXtst-devel libXxf86vm-devel libcap-devel libdisplay-info-devel libdrm-devel libliftoff-devel libxkbcommon-devel meson ninja-build pipewire-devel stb_image-devel stb_image_resize-devel stb_image_write-devel vkroots-devel vulkan-loader-devel wayland-devel wayland-protocols-devel wlroots-devel xorg-x11-server-Xwayland-devel libavif-devel libseat-devel

Clone gamescope

git clone https://github.com/ValveSoftware/gamescope.git
cd gamescope/
git submodule update --init --recursive

Fix subprojects compatibility with gcc14

Apply libliftoff gcc14 patch

(cd subprojects/libliftoff/ && curl https://gist.githubusercontent.com/perroboc/e090a556d262c9775f88295bd4f6b361/raw/b9c56b6afb302243b507801a3c0c94187a3cafcd/libliftoff-gcc14-fedora40.patch | git apply -v --index)

Apply wlroots gcc14 patch

(cd subprojects/wlroots/ && curl https://gist.githubusercontent.com/perroboc/e090a556d262c9775f88295bd4f6b361/raw/b9c56b6afb302243b507801a3c0c94187a3cafcd/wlroots-gcc14-fedora40.patch | git apply -v --index)

Setup build and compile

meson setup -Dpipewire=enabled --reconfigure build/
meson install -C build/ --skip-subprojects
From 29a06add8ef184f85e37ff8abdc34fbaa2f4ee1e Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <[email protected]>
Date: Thu, 21 Dec 2023 20:15:29 +0000
Subject: [PATCH] layer.c: fix build against upcoming `gcc-14`
(`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `libliftoff`:
../layer.c: In function 'liftoff_layer_create':
../layer.c:20:48: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in t
ument [-Werror=calloc-transposed-args]
20 | layer->candidate_planes = calloc(sizeof(layer->candidate_planes[0]),
| ^
../layer.c:20:48: note: earlier argument should specify number of elements, later size of each element
---
layer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layer.c b/layer.c
index 73a8186..6510ea7 100644
--- a/layer.c
+++ b/layer.c
@@ -17,8 +17,8 @@ liftoff_layer_create(struct liftoff_output *output)
return NULL;
}
layer->output = output;
- layer->candidate_planes = calloc(sizeof(layer->candidate_planes[0]),
- output->device->planes_cap);
+ layer->candidate_planes = calloc(output->device->planes_cap,
+ sizeof(layer->candidate_planes[0]));
if (layer->candidate_planes == NULL) {
liftoff_log_errno(LIFTOFF_ERROR, "calloc");
free(layer);
--
GitLab
diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c
index 2e74022a..e5327528 100644
--- a/backend/libinput/tablet_pad.c
+++ b/backend/libinput/tablet_pad.c
@@ -33,7 +33,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad,
++group->ring_count;
}
}
- group->rings = calloc(sizeof(unsigned int), group->ring_count);
+ group->rings = calloc(group->ring_count, sizeof(unsigned int));
if (group->rings == NULL) {
goto group_fail;
}
@@ -50,7 +50,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad,
++group->strip_count;
}
}
- group->strips = calloc(sizeof(unsigned int), group->strip_count);
+ group->strips = calloc(group->strip_count, sizeof(unsigned int));
if (group->strips == NULL) {
goto group_fail;
}
@@ -66,7 +66,7 @@ static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad,
++group->button_count;
}
}
- group->buttons = calloc(sizeof(unsigned int), group->button_count);
+ group->buttons = calloc(group->button_count, sizeof(unsigned int));
if (group->buttons == NULL) {
goto group_fail;
}
@nuc1eon
Copy link

nuc1eon commented May 22, 2025

fixed it for me, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment