Skip to content

Instantly share code, notes, and snippets.

@wyrlwind
Last active January 4, 2025 16:59
Show Gist options
  • Save wyrlwind/65b0539fc8149f604e3b1d6fed1439fe to your computer and use it in GitHub Desktop.
Save wyrlwind/65b0539fc8149f604e3b1d6fed1439fe to your computer and use it in GitHub Desktop.
Compile Gamescope on Ubuntu 22.04.2 LTS (Jammy) - 6.3.0-060300-generic
#!/bin/bash
sudo aptitude -y install git meson ninja-build ninja-build:i386 generate-ninja build-essential cmake libexpat-dev libx11-dev libwayland-dev \
libxkbcommon-dev libx11-xcb-dev libxdamage-dev libxcomposite-dev libxtst-dev \
pkg-config libpipewire-0.3-dev libvulkan-dev libvulkan-dev:i386 glslang-tools libxrender-dev \
libxres-dev libxmu-dev libdrm-dev libxml2-dev graphviz graphviz-dev doxygen \
xsltproc xmlto libsdl2-dev libpixman-1-dev libinput-dev libseat-dev libsystemd-dev \
xwayland libxcb-composite0-dev libxcb-icccm4-dev libxcb-res0-dev libbenchmark-dev libxxf86vm-dev \
libcap-dev edid-decode
cd ~/
#install Vulkan-headers
git clone https://github.com/KhronosGroup/Vulkan-Headers.git && \
cd Vulkan-Headers && \
mkdir build && \
cd build && \
cmake .. && \
sudo make install
cd ~/
#build & compile & install hwdata
git clone https://github.com/vcrhonek/hwdata.git && \
cd hwdata && \
./configure && \
make && \
sudo make install
cd ~/
#build & compile & install Wayland
git clone https://gitlab.freedesktop.org/wayland/wayland && \
cd wayland && \
meson build/ --prefix=/usr && \
sudo ninja -C build/ install
cd ~/
#build & compile & install Wayland-protocols
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git && \
cd wayland-protocols && \
meson build/ --prefix=/usr && \
sudo ninja -C build/ install
cd ~/
#build & compile & install gamescope
git clone https://github.com/ValveSoftware/gamescope.git && \
cd gamescope && \
git submodule update --init && \
meson build/ && \
ninja -C build/ && \
sudo meson install -C build/ --skip-subprojects
@kleinepls
Copy link

I have been trying to build gamescope and its dependencies for hours and I think I got quite close but when I run ninja -C build/ for gamescope the build terminates due to some c++ errors. I really wish this wasn't such a mess to install.

@wyrlwind
Copy link
Author

wyrlwind commented Sep 8, 2024

I have been trying to build gamescope and its dependencies for hours and I think I got quite close but when I run ninja -C build/ for gamescope the build terminates due to some c++ errors. I really wish this wasn't such a mess to install.

Could you paste your c++ error?

@stinky-lizard
Copy link

stinky-lizard commented Dec 22, 2024

I was in the same boat as @kleinepls - I got all the dependencies and meson set up the project but ninja wouldn't compile it. Looking at the compile errors, it was mostly missing format header files thru #include <format>, but there was also some errors about a function SDL_SetPrimarySelectionText not being declared in this scope.

I wasn't sure what to do at first, but looking that function up on the github led me to ValveSoftware/gamescope#1008. Eureka! The newer versions of gamescope depend on an SDL version that isn't on 22.04! I tried installing SDL from the Ubuntu noble repository, but that was simply not happening - too many dependency errors.

So I simply cloned an earlier version of gamescope with $ git clone --depth 1 --branch 3.12.3 https://github.com/ValveSoftware/gamescope.git. With the dependencies installed, it built and compiled on the first try, without a single hiccup. Hooray! The downgrade also seemed to fix the missing includes. Unfortunate that I'll have to use an outdated version, but it is what it is.

I have been trying to build and install gamescope for days. Lutris even recognizes it without any further configuration!

For anyone reading this in the future, I did have to build wayland-server and manually download and install a couple packages from the Ubuntu package archive... I also had to define prefix in /usr/lib/x86_64-linux-gnu/pkgconfig/xwayland.pc with prefix=/usr/bin since it wasn't there by default and pkgconfig wouldn't recognize it, therefore meson failed to find it and refused to build... but this script got me a lot of the way there. If nothing else, it's an easy list of all the dependencies you need, and where to get wayland and build it. Thanks for the help, @wyrlwind!

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