Skip to content

Instantly share code, notes, and snippets.

@willwhui
Created November 19, 2018 07:33
Show Gist options
  • Save willwhui/2d54637a5e2ea0afd54ff1b39b802c9a to your computer and use it in GitHub Desktop.
Save willwhui/2d54637a5e2ea0afd54ff1b39b802c9a to your computer and use it in GitHub Desktop.
通过x11 forwarding运行minecraft
通过x11 forwarding运行minecraft
@willwhui
Copy link
Author

willwhui commented Nov 19, 2018

按照这里:https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=133691

Advanced - X11 Forwarding (Remote Applications)

部分,(貌似)是可以不用在树莓派上安装图形界面组件,直接在工作电脑(比如ubuntu)上显示minecraft图形界面,在pi上运行minecraft程序内核的。

以ubuntu为x server,运行minecraft图形显示界面
以raspberry pi为x client,运行minecraft内核
预先在pi上安装好 xauth:

sudo apt-get install xauth

然后在ubuntu命令行运行以下命令,登录到pi

ssh -X pi@ip-of-raspberry-pi

在ssh中运行minecraft

cd ~/mcpi
./minecraft-pi &

得到一个错误:

./minecraft-pi: error while loading shared libraries: libGLESv2.so: cannot open shared object file: No such file or directory

@willwhui
Copy link
Author

willwhui commented Nov 19, 2018

参考这里:http://mattyjwilliams.blogspot.com/2013/03/some-useful-development-patterns-via.html
运行如下命令行:

ldd ./minecraft-pi

可以看到好几个依赖缺失。
此时参考https://www.raspberrypi.org/forums/viewtopic.php?t=191857#p1203490
创建这些文件的链接

cd /opt/vc/lib
sudo ln -s libbrcmEGL.so libEGL.so
sudo ln -s libbrcmGLESv2.so libGLESv2.so
sudo ln -s libbrcmOpenVG.so libOpenVG.so
sudo ln -s libbrcmWFC.so libWFC.so

运行如下命令行:

LD_LIBRARY_PATH=/opt/vc/lib ./minecraft-pi

得到一个新的错误:

error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

于是在命令行输入:

sudo apt-get install libpng12

不回车,按tab键,可以看到有两个libpng12
"libpng12-0 libpng12-dev"
随便选了一个libpng12-0:

sudo apt-get install libpng12-0

再运行:

LD_LIBRARY_PATH=/opt/vc/lib ./minecraft-pi

得到了一个无内容的新窗口,正如文章中所述。
说如果你在树莓派上连接了显示器,就可以在树莓派上看到有内容的窗口了!
(╯°Д°)╯ ┻━┻
但我并没有在树莓派上安装图形界面组件,也没有连接显示器上去。
因为我理解的X forwarding不是这样的。

@willwhui
Copy link
Author

但是我在树莓派上安装一些小组件,尝试用x forwarding模式运行时,是可以的。
比如:

ssh -X pi@ip-of-raspberry-pi
sudo apt-get install x11-apps
xclock

就可以在ubuntu上显示一个时钟了。
看来是别的问题。

@willwhui
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment