wsl+ubuntu20.04.02+xming图形化界面

安装wsl和ubuntu都没问题,
为了后续配置,需要看看自己的wsl是1还是2
使用如下命令

wsl -l -v

在zshrc或bashrc中添加如下代码(我是wsl1)

export DISPLAY=:0 # in WSL 1
# export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 # in WSL 2
export LIBGL_ALWAYS_INDIRECT= 
export LIBGL_ALWASY_SOFTWARE=1

然后

source ~/.zshrc

在windows中下载安装Xming并启动
https://sourceforge.net/projects/xming/

启动windows terminal(按住alt点击顶部的+可以打开第二个terminal)

 roscore
 rosrun turtlesim turtlesim_node
 rosrun turtlesim turtle_teleop_key

实验一下,能够顺利跑起来显示小乌龟即说明成功。
注:
期间启动turtlesim时发生了一个问题:

/opt/ros/noetic/lib/rviz/rviz: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
解决办法参照:https://askubuntu.com/questions/1034313/ubuntu-18-4-libqt5core-so-5-cannot-open-shared-object-file-no-such-file-or-dir

whereis libQt5Core.so.5
#把路径复制下来
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

然后问题就解决了,据说是The above command “strips out” a piece of code which is looking in the kernel for something not there, and allows the module to load.(上面的命令“删除”了一段在内核中寻找不存在的东西的代码,并允许加载该模块。)

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值