Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Running Forge 27/Vanilla 1.20 in Wayland Native #58

Open
patrickpmueller opened this issue Jan 3, 2024 · 1 comment
Open

[FIX] Running Forge 27/Vanilla 1.20 in Wayland Native #58

patrickpmueller opened this issue Jan 3, 2024 · 1 comment

Comments

@patrickpmueller
Copy link

Problem

Hi all!
When I tried to install the patches on my system (even the one-nineteen and libdecoration branches) GLFW was spitting out the error

Wayland: setting the window position is not supported on this platform.

My system:

  • Arch Linux with the linux kernel
  • RTX 3070 Ti with nvidia-open (545) driver
  • i5 12600KF with 16GB RAM
  • Forge 27 or vanilla Minecraft 1.20 (also crashes and gets fixed but has a different error)

Solution

To fix this issue, you have to manually apply the patches to the master branch of GLFW.
This fix will break in the future as it is based on the active and changing master branch, not a static release.

Downloading GLFW

You might want to cd into your downloads or temp folder if you don't want to clutter your $HOME.

git clone https://github.com/glfw/glfw.git
cd glfw

Download the patch

I have combined the patches 0003, 0005 and the necessary patch to mute the error that causes forge to crash on start
Copy and paste it into a file called glfw.patch, the last empty line is important as otherwise it refuses to git apply - this file should be located in the glfw dir that you just cd'd into.
gist.github.com/patrickpmueller/3e24a3ba435c1708a3ebace60cfa1dcf

If patch somehow fails (in case GLFW updated their code in this part) manually review patch, find the section of code and replace it. You can use patches from repo, one-nineteen branch, etc. but be sure to add the patch for the window position.

Applying the patch and compiling GLFW

Just run the commands below:

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

Using the patched version to start Forge 27

You can

  • either install GLFW on your system via make install
  • or use it for Minecraft locally by following the launcher part in github.com/Admicos/minecraft-wayland?tab=readme-ov-file#requirements and pointing it to your patched ./src/libglfw.so.3.4

Export a neccessary environment variable

This is neccessary becuase Minecraft crashed otherwise (I don't have the error message any more, but this fixed it).
Name: __GL_THREADED_OPTIMIZATIONS
Value: 0

Result

This should fix any issues related to Forge 27 and should also fix vanilla 1.20.
I might include a PKGBUILD in the future - or someone can share it if they write it.

Note: this is a temporary fix that just suppresses the errors instead of properly fixing them. However, at least it works without XWayland

@Piecuuu
Copy link

Piecuuu commented Mar 25, 2024

I'm experiencing the same issue, but on a Intel iGPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants