在Sourceforge.net里发现很多好玩的游戏软件。于是,我想下载到我的本机电脑上来玩。首先,我的系统信息:
Linux localhost.localdomain 2.6.32-358.23.2.el6.i686 #1 SMP Wed Oct 16 17:21:31 UTC 2013 i686 i686 i386 GNU/Linux
下载到本地,的包是warzone2100-3.1.1.tar.xz,解压:
$ xz -d warzone2100-3.1.1.tar.xz $ tar xf warzone2100-3.1.1.tar
解压后进入源码目录,看到有configure文件,二话不说,先执行:
$ ./configure ...(略) checking for backend... SDL checking for QT4... /usr/bin/pkg-config no configure: error: Qt not found - required!
说什么Qt4没找着?!可我己在 /usr/local/Trolltech/Qt-4.8.5/ 目录下安装了Qt的了?
不知道为什么出错,于是打开configure进去看个究竟。
好像是在执行 pkg-config --libs "QtCore QtNetwork QtScript"时出的错。于是我把这个命令单独提取出来执行:
$ pkg-config --libs "QtCore"Package QtCore was not found in the pkg-config search path. Perhaps you should add the directory containing `QtCore.pc' to the PKG_CONFIG_PATH environment variable No package 'QtCore' found
于是我找了一个QtCore.pc文件。
$ locate QtCore.pc /home/xxx/Install/qt-downloads/qt-everywhere-opensource-src-4.8.5/lib/pkgconfig/QtCore.pc /usr/local/Trolltech/Qt-4.8.5/lib/pkgconfig/QtCore.pc
可是为什么我将 PKG_CONFIG_PATH设置成了 /usr/local/Trolltech/Qt-4.8.5/lib/pkgconfig 还是找不到。
原来是要加export:
export PKG_CONFIG_PATH=/usr/local/Trolltech/Qt-4.8.5/lib/pkgconfig/:$PKG_CONFIG_PATH
试了一下:
$ pkg-config --libs QtGui QtScript -L/usr/local/Trolltech/Qt-4.8.5/lib -lQtGui -lQtScript -lQtCore
OK了!
然后再 ./configure,QT4这关算是过了。然后:
$ ./configure checking whether the C compiler accepts the -Werror -Wno-enum-compare flag... yes checking for SDL... configure: error: Package requirements (sdl >= 1.2) were not met: No package 'sdl' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SDL_CFLAGS and SDL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
安装sdl
$ sudo yum install SDL-devel
再./configure,这次缺theora,查一下:
$ yum search theora libtheora.i686 : Theora Video Compression Codec libtheora-devel.i686 : Development tools for Theora applications libtheora-devel-docs.noarch : Documentation for developing Theora applications theora-tools.i686 : Command line tools for Theora videos $ sudo yum install libtheora-devel
接下来的是openal,安装。
从 http://kcat.strangesoft.net/openal.html#download 下载源码,然后安装。解压:
$ tar jxvf openal-soft-1.15.1.tar.bz2 $ cd openal-soft-1.15.1 $ vi README #打开说明看如何安装 $ cd build $ cmake .. $ make $ make install [sudo] password for hevake_lcj: [ 3%] Built target makehrtf [ 96%] Built target openal [100%] Built target openal-info Install the project... -- Install configuration: "RelWithDebInfo" -- Up-to-date: /usr/local/lib/libopenal.so.1.15.1 -- Up-to-date: /usr/local/lib/libopenal.so.1 -- Up-to-date: /usr/local/lib/libopenal.so -- Up-to-date: /usr/local/include/AL/al.h -- Up-to-date: /usr/local/include/AL/alc.h -- Up-to-date: /usr/local/include/AL/alext.h -- Up-to-date: /usr/local/include/AL/efx.h -- Up-to-date: /usr/local/include/AL/efx-creative.h -- Up-to-date: /usr/local/include/AL/efx-presets.h -- Up-to-date: /usr/local/lib/pkgconfig/openal.pc -- Up-to-date: /usr/local/share/openal/alsoftrc.sample -- Up-to-date: /usr/local/bin/openal-info -- Up-to-date: /usr/local/bin/makehrtf
我们继续,./configure,还是卡在这里。
$ ./configure ... checking for OPENAL... configure: error: Package requirements (openal >= 0.0.8) were not met: No package 'openal' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables OPENAL_CFLAGS and OPENAL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
哦,我明白了,要像上面解决QT4问题一样,将/usr/local/lib/pkgconfig/目录也加到PKG_CONFIG_PATH中去。
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
再来,./configure,这会儿是vorbis。照样先用yum安装,如果不行再到网上去找源码包。
嘿,还真有:libvorbis-devel.i686,安装。
再来,./configure,这会儿是glew,yum里没有找到。去google上找源码包。http://glew.sourceforge.net/
$ unzip glew-1.10.0.zip $ cd glew-1.10.0 $ sudo make cc -shared -Wl,-soname=libGLEW.so.1.10 -o lib/libGLEW.so.1.10.0 tmp/linux/default/shared/glew.o -L/usr/X11R6/lib -L/usr/lib -lXmu -lXi -lGL -lXext -lX11 /usr/bin/ld: cannot find -lXmu collect2: ld returned 1 exit status make: *** [lib/libGLEW.so.1.10.0] Error 1
差个Xmu,到yum里去找。
$ sudo yum install libXmu-devel
又差个Xi,到yum里去找。
$ sudo yum install libXi-devel
这下glew安装OK了。
那继续,./configure,这下是PhysicsFS.
$ ./configure checking for GLEW... yes checking for nearbyint in -lm... yes checking physfs.h usability... no checking physfs.h presence... no checking for physfs.h... no configure: error: PhysicsFS header not found.
yum里没有,只能到网上去找:http://icculus.org/pipermail/physfs/2012-October/001056.html
$ tar jvxf physfs-2.0.3.tar.bz2 $ cd physfs-2.0.3 $ cmake . $ make $ sudo make install
然后,我们继续./configure,现在是fribidi。http://fribidi.org/
$ tar jvxf fribidi-0.19.6.tar.bz2 $ cd fribidi-0.19.6 $ ./configure $ make $ sudo make install
继续 ./configure,又是fontconfig,yum里有,直接安装。
继续 ./configure,这次是通过了。
config.status: creating po/Makefile configure: configure: WARNING: Distributor unknown! configure: Use --with-distributor when compiling package for distribution configure: configure: WARNING: a2x (asciidoc) or wkhtmltopdf not found, can't convert documentation. This doesn't affect building the game, but means that things like "make dist" and building a Windows installer will fail. configure: configure: Backend used: sdl
还差一个 wkhtmltopdf,yum里没有。去网上下载:http://code.google.com/p/wkhtmltopdf/downloads/detail?name=wkhtmltopdf-0.11.0_rc1.tar.bz2
$ tar jvxf wkhtmltopdf-0.11.0_rc1.tar.bz2 $ cd wkhtmltopdf-0.11.0_rc1 # 发现里面没有./configure,只有.pro文件。所以我执行qmake $ qmake $ make
上面的问题还是没有解决,不过这个不影响我们编译。好,现在我们要开工了~~~~~~
$ make
OK,通过了!!!开始安装!
$ sudo make install
OK了!
查一下系统目录[Applications]-->[Games]-->[Warzone 2100],Oh Yeath!
--------------------------------
等等,好像启动不起来?我们命令启动看看。
$ warzone2100 warzone2100: error while loading shared libraries: libphysfs.so.1: cannot open shared object file: No such file or directory
这个动态库找不到,这个问题好解决。查一下libphysfs.so.1文件。查一下这个动态库文件在哪。
$ locate libphysfs.so.1 /home/hevake_lcj/Install/some-libs/physfs-2.0.3/libphysfs.so.1 /usr/local/lib/libphysfs.so.1
将 /usr/local/lib 加入 /etc/ld.so.conf
刚打开文件看了一下,文件里有这个路径。可能是没有更新吧。
$ sudo ldconfig
OK,我们再来运行游戏。
$ warzone2100 warzone2100: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by warzone2100)
额,这回是libstdc++.so.6文件的版本不够。我之前编译了一个高版本的libstdc++.so.6,复制过去就OK了。
sudo cp /usr/local/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6
再来,我们启动游戏。
这回是:
$ warzone2100 warzone2100: symbol lookup error: warzone2100: undefined symbol: _ZN16QCoreApplicationC1ERiPPci
唉,真是不让人省心!明天再搞吧,太晚了~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
今晚我们继续。
我在google上查了一下上面的这个错误。http://qt-project.org/forums/viewthread/14032
说是没有指定Qt动态链接库的路径。要将Qt库路径加到LD_LIBRARY_PATH中。
我的Qt安装在 /usr/local/Trolltech/Qt-4.8.5/ 目录下,那么QT库路径就是 /usr/local/Trolltech/Qt-4.8.5/lib。OK,我加进去试试看。
$ export LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.8.5/lib:$LD_LIBRARY_PATH
然后,我再启动游戏。哈哈,这下果然可以正常启动了。
除了上面的图片以外,还有很动感的音乐!好Happle呀,历经千辛终于成功了。这种喜悦是直接下来个rpm包来安装不能比拟的。
对了,还有一项工作没有做完。上面只是用命令设置了LD_LIBRARY_PATH,使之指向了QT库。可以后不能每次都设置一次呀。
那就样这个路径加到 /etc/ld.so.conf 文件中去,然后再 ldconfig 一下。
大功告成!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
啊~~我滴个神咧,卡得要死。完全没法玩!是不是显卡的问题?我安装一下我电脑的显卡驱动。
步骤详见:CentOS安装NVIDIA驱动记
然后玩起来就不卡了,很流畅!