minecraft-wayland
minecraft-wayland copied to clipboard
Fix >=1.19 by building glfw from git
You have to build glfw from git and include the two patches: 0003-Don-t-crash-on-calls-to-focus-or-icon.patch 0007-Platform-Prefer-Wayland-over-X11.patch
I did it for fedora on: https://copr.fedorainfracloud.org/coprs/uriesk/minecraft-wayland-glfw-git/
And the checkbox to use system glfw does not work in current versions, so it's best to just recommend the argument -Dorg.lwjgl.glfw.libname=/usr/lib64/libglfw.so.3 for all launchers, because that always works.
This is the official repository: https://github.com/glfw/glfw
Reason why you need git version: https://github.com/PrismLauncher/PrismLauncher/issues/1538#issuecomment-1684901201
I combined these two patches in one glfw.patch.txt. If patch somehow fails (in case glfw updated their code in this part) - manually review patch, find code and replace it. You of course can use patches from repo, one-nineteen branch, etc.
Here all the commands you will need:
Probably better to cd to your downloads directory first if you don't want to litter $HOME
git clone --filter=tree:0 https://github.com/glfw/glfw.git
cd glfw
cp /path/to/downloaded/patch ./glfw.patch
git apply glfw.patch
cmake -S . -B build -D GLFW_USE_WAYLAND=1 -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_EXAMPLES=no -D GLFW_BUILD_TESTS=no -D GLFW_BUILD_DOCS=no
cd build
make
This will compile you ./src/libglfw.so.3.4. You can either install glfw that you have just compiled using make install, or just manually copy libglfw.so.3.4 to any place and name it how you want.
After that do not forget to add -Dorg.lwjgl.glfw.libname=/path/to/your/compiled/glfw.
If installed via make install, use make uninstall to remove patched glfw from your system.
This method fixes glfwInitAllocator issue, because this function is provided by unreleased version of glfw, and it doesn't rely on any distro's packaging. Currently this is the most reliable way to avoid all wayland related crashes.