LoginSignup
0
0

More than 1 year has passed since last update.

Xmingでrqtが開けなかった話

Posted at

はじめに

ros2の勉強をwsl2で始めようとしたとき、なぜかXmingではrqtが出ませんでした。
具体的には以下のエラーが、

X server does not support XInput 2
failed to get the current screen resources
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ubuntu'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
The X11 connection broke: I/O error (code 1)
XIO:  fatal IO error 0 (Success) on X server "172.18.16.1:0.0"
      after 366 requests (366 known processed) with 0 events remaining

しょうがないのでVcXsrvを使ってみたら成功したので、セットアップを記述します。
特に変わったことはしていません。

過去にXmingをセットアップした時の記事はこちら
https://qiita.com/kaerun/items/fb8ff6295e82bdea0c45

環境

  • WSL2
    • Ubuntu 20.04.4 LTS
  • VcXsrv-64.1.20

方法

VcXsrvの準備

公式からinstaller.exeをダウンロード、インストール

設定は参考記事通りに
image.png

.bashrcの変更

以下をたたく
起動毎にたたくのも面倒なので.bashrcに書いておくとよき

export DISPLAY=$(ipconfig.exe | grep IPv4 | grep 192 | awk -F'[ ]' '{print $17}' | tr -dc 0-9.):0.0
コマンドの解説

参考サイトに書いてある通り以下の設定をする必要がある

export DISPLAY=aaa.bbb.c.dd:0.0

aaa.bbb.c.ddはwslを起動しているパソコンのipアドレス
0.0はVcXsrvを起動している時のアイコンにカーソルを合わせた時に出る番号

aaa.bbb.c.dd:0.0の部分を渡すコマンドを作りたいのでパイプでつないでいく
awkを叩いた時点で完成しているように見えるが、改行などの制御文字が末尾に入っているため、trをする

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0