在Sourceforge.net裏發現不少好玩的遊戲軟件。因而,我想下載到個人本機電腦上來玩。首先,個人系統信息:html
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
linux
下載到本地,的包是warzone2100-3.1.1.tar.xz,解壓:c++
$ xz -d warzone2100-3.1.1.tar.xz $ tar xf warzone2100-3.1.1.tar
解壓後進入源碼目錄,看到有configure文件,二話不說,先執行:bash
$ ./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的了?app
不知道爲何出錯,因而打開configure進去看個究竟。dom
好像是在執行 pkg-config --libs "QtCore QtNetwork QtScript"時出的錯。因而我把這個命令單獨提取出來執行:ide
$ 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文件。ui
$ 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 仍是找不到。google
原來是要加export:spa
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驅動記
而後玩起來就不卡了,很流暢!