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;
}
@testc2n14
Copy link

so every time i run these comand i get errors

c2n14@fedora:~/gamescope$ (cd subprojects/wlroots/ && curl https://gist.githubusercontent.com/perroboc/e090a556d262c9775f88295bd4f6b361/raw/b9c56b6afb302243b507801a3c0c94187a3cafcd/wlroots-gcc14-fedora40.patch | git apply -v --index)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1115 100 1115 0 0 3690 0 --:--:-- --:--:-- --:--:-- 3692
Checking patch backend/libinput/tablet_pad.c...
error: while searching for:
++group->ring_count;
}
}
group->rings = calloc(sizeof(unsigned int), group->ring_count);
if (group->rings == NULL) {
goto group_fail;
}

error: patch failed: backend/libinput/tablet_pad.c:33
error: backend/libinput/tablet_pad.c: patch does not apply
c2n14@fedora:~/gamescope$ meson setup -Dpipewire=enabled --reconfigure build/
meson install -C build/ --skip-subprojects
The Meson build system
Version: 1.4.0
Source dir: /home/c2n14/gamescope
Build dir: /home/c2n14/gamescope/build
Build type: native build
Project name: gamescope
Project version: undefined
C compiler for the host machine: cc (gcc 14.0.1 "cc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
C linker for the host machine: cc ld.bfd 2.41-34
C++ compiler for the host machine: c++ (gcc 14.0.1 "c++ (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
C++ linker for the host machine: c++ ld.bfd 2.41-34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C++ supports arguments -Wno-unused-parameter: YES
Compiler for C++ supports arguments -Wno-missing-field-initializers: YES
Compiler for C++ supports arguments -Wno-c99-designator: NO
Compiler for C++ supports arguments -Wno-invalid-offsetof: YES
Compiler for C++ supports arguments -Wno-unused-const-variable: YES
Compiler for C++ supports arguments -Wno-volatile: YES
Compiler for C++ supports arguments -Wno-deprecated-volatile: NO
Compiler for C++ supports arguments -Wno-ignored-qualifiers: YES
Compiler for C++ supports arguments -Wno-missing-braces: YES
Compiler for C++ supports arguments -ffast-math: YES
Found pkg-config: YES (/usr/bin/pkg-config) 2.1.0
Run-time dependency libpipewire-0.3 found: YES 1.0.5
Library rt found: YES
Run-time dependency hwdata found: YES 0.381
Run-time dependency x11 found: YES 1.8.9
Run-time dependency wayland-client found: YES 1.22.0
Run-time dependency vulkan found: YES 1.3.280
Found CMake: /usr/bin/cmake (3.28.2)
Run-time dependency openvr found: NO (tried pkgconfig and cmake)

Executing subproject openvr method cmake

openvr| Found CMake: /usr/bin/cmake (3.28.2)

| Configuring the build directory with CMake version 3.28.2
| Running CMake with: -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DUSE_LIBCXX=False
| - build directory: /home/c2n14/gamescope/build/subprojects/openvr/__CMake_build
| - source directory: /home/c2n14/gamescope/subprojects/openvr
| - toolchain file: /home/c2n14/gamescope/build/subprojects/openvr/__CMake_build/CMakeMesonToolchainFile.cmake
| - preload file: /usr/lib/python3.12/site-packages/mesonbuild/cmake/data/preload.cmake
| - trace args: --trace-expand --trace-format=json-v1 --no-warn-unused-cli --trace-redirect=cmake_trace.txt
| - disabled policy warnings: [CMP0025, CMP0047, CMP0056, CMP0060, CMP0065, CMP0066, CMP0067, CMP0082, CMP0089, CMP0102]

| CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
| Compatibility with CMake < 3.5 will be removed from a future version of
| CMake.

| Update the VERSION argument value or use a ... suffix to tell
| CMake that the project does not need compatibility with older versions.

| Put cmake in trace mode, but with variables expanded.
| Put cmake in trace mode and sets the trace output format.
| Not searching for unused variables given on the command line.
| Put cmake in trace mode and redirect trace output to a file instead of stderr.
| Trace will be written to cmake_trace.txt

| -- The C compiler identification is GNU 14.0.1
| -- The CXX compiler identification is GNU 14.0.1
| CMake Warning (dev) at /usr/share/cmake/Modules/CMakeFindBinUtils.cmake:224 (find_program):
| Policy CMP0126 is not set: set(CACHE) does not remove a normal variable of
| the same name. Run "cmake --help-policy CMP0126" for policy details. Use
| the cmake_policy command to set the policy and suppress this warning.

| For compatibility with older versions of CMake, normal variable
| "CMAKE_TAPI" will be removed from the current scope.
| Call Stack (most recent call first):
| /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:202 (include)
| CMakeLists.txt:5 (project)
| This warning is for project developers. Use -Wno-dev to suppress it.

| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /usr/bin/cc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Check for working CXX compiler: /usr/bin/c++ - skipped
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Configuring done (0.3s)
| -- Generating done (0.0s)
| -- Build files have been written to: /home/c2n14/gamescope/build/subprojects/openvr/__CMake_build

openvr| CMake configuration: SUCCEEDED
openvr| CMake project OpenVRSDK has 1 build targets.
openvr| Generated Meson AST: /home/c2n14/gamescope/build/subprojects/openvr/meson.build
openvr| Project name: OpenVRSDK
openvr| Project version: undefined
openvr| C++ compiler for the host machine: c++ (gcc 14.0.1 "c++ (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
openvr| C++ linker for the host machine: c++ ld.bfd 2.41-34
openvr| Build targets in project: 1
openvr| Subproject openvr finished.

Check usable header "vulkan/vulkan.h" with dependency vulkan: YES
Build-time dependency wayland-scanner found: YES 1.22.0
Program /usr/bin/wayland-scanner found: YES (/usr/bin/wayland-scanner)
Run-time dependency wayland-protocols found: YES 1.34
Looking for a fallback subproject for the dependency vkroots because:
Use of fallback dependencies is forced.

Executing subproject vkroots

vkroots| Project name: vkroots
vkroots| Project version: undefined
vkroots| C++ compiler for the host machine: c++ (gcc 14.0.1 "c++ (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
vkroots| C++ linker for the host machine: c++ ld.bfd 2.41-34
vkroots| Build targets in project: 43
vkroots| Subproject vkroots finished.

Dependency vkroots found: YES undefined (overridden)
Run-time dependency xcb found: YES 1.16
Run-time dependency x11-xcb found: YES 1.8.9
Run-time dependency glm found: YES 0.9.9
Dependency wayland-client found: YES 1.22.0 (cached)
Configuring VkLayer_FROG_gamescope_wsi.x86_64.json using configuration
Run-time dependency xdamage found: YES 1.1.6
Run-time dependency xcomposite found: YES 0.4.6
Run-time dependency xcursor found: YES 1.2.1
Run-time dependency xrender found: YES 0.9.11
Run-time dependency xext found: YES 1.3.6
Run-time dependency xfixes found: YES 6.0.1
Run-time dependency xxf86vm found: YES 1.1.5
Run-time dependency xtst found: YES 1.2.4
Run-time dependency xres found: YES 1.2.2
Run-time dependency xmu found: YES 1.2.0
Run-time dependency xi found: YES 1.8.1
Run-time dependency libdrm found: YES 2.4.120
Run-time dependency libeis-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency wayland-server found: YES 1.22.0
Dependency wayland-protocols found: YES 1.34 (cached)
Run-time dependency xkbcommon found: YES 1.6.0
Run-time dependency threads found: YES
Run-time dependency libcap found: YES 2.69
Run-time dependency epoll-shim found: NO (tried pkgconfig and cmake)
Dependency glm found: YES 0.9.9 (cached)
Run-time dependency sdl2 found: YES 2.30.1
Run-time dependency stb found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency stb
Initialized empty Git repository in /home/c2n14/gamescope/subprojects/stb/.git/
remote: Enumerating objects: 436, done.
remote: Counting objects: 100% (436/436), done.
remote: Compressing objects: 100% (364/364), done.
remote: Total 436 (delta 76), reused 351 (delta 62), pack-reused 0
Receiving objects: 100% (436/436), 1.39 MiB | 692.00 KiB/s, done.
Resolving deltas: 100% (76/76), done.
From https://github.com/nothings/stb

  • branch 5736b15f7ea0ffb08dd38af21067c314d6a3aae9 -> FETCH_HEAD
    HEAD is now at 5736b15 re-add perlin noise again

Executing subproject stb

stb| Project name: stb
stb| Project version: 0.1.0
stb| C compiler for the host machine: cc (gcc 14.0.1 "cc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
stb| C linker for the host machine: cc ld.bfd 2.41-34
stb| Build targets in project: 44
stb| Subproject stb finished.

Dependency stb found: YES 0.1.0 (overridden)
Run-time dependency libavif found: YES 1.0.4
Looking for a fallback subproject for the dependency wlroots because:
Use of fallback dependencies is forced.

Executing subproject wlroots

wlroots| Project name: wlroots
wlroots| Project version: 0.18.0-dev
wlroots| C compiler for the host machine: cc (gcc 14.0.1 "cc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)")
wlroots| C linker for the host machine: cc ld.bfd 2.41-34
wlroots| Compiler for C supports arguments -Wundef: YES
wlroots| Compiler for C supports arguments -Wlogical-op: YES
wlroots| Compiler for C supports arguments -Wmissing-include-dirs: YES
wlroots| Compiler for C supports arguments -Wold-style-definition: YES
wlroots| Compiler for C supports arguments -Wpointer-arith: YES
wlroots| Compiler for C supports arguments -Winit-self: YES
wlroots| Compiler for C supports arguments -Wstrict-prototypes: YES
wlroots| Compiler for C supports arguments -Wimplicit-fallthrough=2: YES
wlroots| Compiler for C supports arguments -Wendif-labels: YES
wlroots| Compiler for C supports arguments -Wstrict-aliasing=2: YES
wlroots| Compiler for C supports arguments -Woverflow: YES
wlroots| Compiler for C supports arguments -Wmissing-prototypes: YES
wlroots| Compiler for C supports arguments -Walloca: YES
wlroots| Compiler for C supports arguments -Wno-missing-braces: YES
wlroots| Compiler for C supports arguments -Wno-missing-field-initializers: YES
wlroots| Compiler for C supports arguments -Wno-unused-parameter: YES
wlroots| Compiler for C supports arguments -fmacro-prefix-map=/prefix/to/hide=: YES
wlroots| Dependency wayland-server found: YES 1.22.0 (cached)
wlroots| Dependency libdrm found: YES 2.4.120 (cached)
wlroots| Dependency xkbcommon found: YES 1.6.0 (cached)
wlroots| Run-time dependency pixman-1 found: YES 0.43.0
wlroots| Library m found: YES
wlroots| Library rt found: YES
wlroots| Dependency wayland-protocols found: YES 1.34 (cached)
wlroots| Dependency wayland-scanner found: YES 1.22.0 (cached)
wlroots| Program /usr/bin/wayland-scanner found: YES (/usr/bin/wayland-scanner)
wlroots| Has header "linux/dma-buf.h" : YES
wlroots| Has header "sys/eventfd.h" : YES
wlroots| Dependency pixman-1 found: YES 0.43.0 (cached)
wlroots| Run-time dependency libudev found: YES 255
wlroots| Run-time dependency libseat found: YES 0.8.0
wlroots| Run-time dependency libinput found: YES 1.25.0
wlroots| Dependency wayland-client found: YES 1.22.0 (cached)
wlroots| Run-time dependency xwayland found: YES 23.2.6
wlroots| Dependency xcb found: YES 1.16 (cached)
wlroots| Run-time dependency xcb-composite found: YES 1.16
wlroots| Run-time dependency xcb-ewmh found: YES 0.4.2
wlroots| Run-time dependency xcb-icccm found: YES 0.4.2
wlroots| Run-time dependency xcb-render found: YES 1.16
wlroots| Run-time dependency xcb-res found: YES 1.16
wlroots| Run-time dependency xcb-xfixes found: YES 1.16
wlroots| Run-time dependency xcb-errors found: YES 1.0.1
wlroots| Checking for function "xcb_xfixes_set_client_disconnect_mode" with dependencies xcb, xcb-composite, xcb-ewmh, xcb-icccm, xcb-render, xcb-res, xcb-xfixes, xcb-errors: YES
wlroots| Configuring config.h using configuration
wlroots| Configuring version.h using configuration
wlroots| Configuring config.h using configuration
wlroots| Build targets in project: 177
wlroots| Subproject wlroots finished.

Dependency wlroots found: YES 0.18.0-dev (overridden)
Run-time dependency libdisplay-info found: YES 0.1.1
Run-time dependency libdecor-0 found: NO (tried pkgconfig and cmake)

src/meson.build:41:15: ERROR: Dependency "libdecor-0" not found, tried pkgconfig and cmake

A full log can be found at /home/c2n14/gamescope/build/meson-logs/meson-log.txt
Install data not found. Run this command in build directory root.
c2n14@fedora:~/gamescope$

@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