seigot / tetris

A Tetris Game for programming education in Japanese
MIT License
30 stars 107 forks source link

window wsl環境で実行を試みたものの起動しない(`qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.`) #44

Open seigot opened 2 years ago

seigot commented 2 years ago

window wsl環境で実行を試みたものの,添付のエラーが発生し,起動しませんでした.下記のURLでの解決策を試みても,起動しませんでした.の辺り

https://qiita.com/fukasawah/items/99219e1ff7d08915952f https://medicalfields.jp/blog/python/ubuntu%e3%81%a7python3%e3%81%a7pyqt5%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%9f%e3%81%84%e3%81%ae%e3%81%ab%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%8c%e3%81%a7%e3%82%8b/

おそらくWSL上でDISPLAY変数が使えていない https://github.com/seigot/tetris/blob/master/doc/files/install_windows_wsl.md https://qiita.com/yugo-yamamoto/items/28e3d2a090f8f546f3ec https://qiita.com/1024xx4/items/45a5cce13eafa17ca6f1 https://techinfoofmicrosofttech.osscons.jp/index.php?WSL%20→%20WSL2#ocd43b8b

seigot commented 2 years ago

windows11であれば以下で解決する可能性あり

windows11であれば、最新のwsl2を使用することで、wsl2で起動したGUIアプリを勝手にwindowsのデスクトップに表示してくれます。(テトリスの画面が出るようになります) なので、やることとしては以下になります。 ・wsl1なのかwsl2なのか確認https://docs.microsoft.com/ja-jp/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2 ・wsl2であれば最新版にする(wsl --update、pc再起動した方がいいかもです)

https://qiita.com/yugo-yamamoto/items/28e3d2a090f8f546f3ec が参考になります。 sudo apt install x11-apps後にxeyesを打って目の絵が出てくれば成功です。

gitauto-ai[bot] commented 2 weeks ago

The issue you're experiencing with the Qt platform plugin "xcb" on WSL1 is due to limited GUI support and missing dependencies in WSL1. Here are the steps to resolve this:

  1. Upgrade to WSL2: WSL2 provides better support for GUI applications. You can upgrade by running:

    wsl --update
    wsl --set-version <distribution_name> 2

    For detailed instructions, refer to Microsoft's official documentation.

  2. Install Required Qt Dependencies: In WSL2, run the following commands to install necessary packages:

    sudo apt-get update
    sudo apt-get install -y libxcb-xinerama0
  3. Set DISPLAY Environment Variable and Start X Server:

    • Start an X server on Windows (e.g., VcXsrv or GWSL).
    • Set the DISPLAY environment variable in WSL2 by adding the following to your ~/.bashrc:
      echo 'export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0' >> ~/.bashrc
      source ~/.bashrc
  4. Update Documentation: Add these steps to doc/files/install_windows_wsl.md to guide users through the setup process.

These steps should help resolve the issue by ensuring the necessary environment and dependencies are in place for running Qt applications on WSL.