MCSLTeam / MCSL2

MCSL2 | 一个简洁全能的Minecraft开服器

Home Page:https://mcsl.com.cn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG|强制QT_QPA_PLATFORM=“wayland”导致使用xorg时无法启动

fecwaqw opened this issue · comments

  • 并非电脑自身造成
  • MCSL 2 运行在受官方支持的平台上

一般要素

  • 系统:Arch Linux x86_64 Linux6.1.30-1-lts
  • 架构:x86_64
  • MCSL 2 版本:2.1.3.6

问题描述

在使用xorg时因为在MCSL2.py中QT_QPA_PLATFORM环境变量被设为“wayland”而导致启动时报错

Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

复现

使用xorg为显示服务器的Linux运行MCSL2.py

可能的解决方案(?)

加入显示服务器的判断后更改QT_QPA_PLATFORM环境变量
如将MCSL2.py的第1486行到1487行改为:

from os import environ, system
...
if system().lower() == 'linux':
    if environ["XDG_SESSION_TYPE"].lower() != 'x11':
        environ["QT_QPA_PLATFORM"] = "wayland"
...

已修复。