OMNeT++是一個事件驅動的仿真器,适合做離散事件網絡系統仿真。通常可進行通信系統通信模型仿真、協定仿真、硬體體系結構驗證、複雜軟體系統性能評估、任何其他離散事件驅動應用的模組化與仿真。
OMNeT++在原理和結構上與OPNET(大名鼎鼎的商用仿真器)相似。而它是免費的,且上手很快。
因為某種需要,是以在FC5下安裝了一個OMNeT++,并整理了相關步驟。
1.先從網上下載下傳omnetpp包,我的是omnetpp-3.3-src.gz
然後解壓到/root下,我的是解壓到/root下,其實路徑可以自己定。
$tarzxvf omnetpp-3.3-src.gz
$mv omnetpp-3.3 /root/
2.設定環境變量
$vi /root/.bashrc
–>加入如下設定
export PATH=$PATH:/root/omnetpp-3.3/bin
export LD_LIBRARY_PATH=/root/omnetpp-3.3/lib
exportTCL_LIBRARY=/usr/lib/tcl8.4
需要設定PATH,LD_LIBRARY_PATH還需要設定TCL_LIBRARY,讓OMNEST/OMNeT++ GUI程式能夠找到BLT庫.實際上,./configure結束後,會檢測環境變量是否設定.若未設定(或設定後未logout, log in), 它會提示你設定.是以在這裡先設定了。
3../configure觀察warning和error
下面列出一些error的排除方法
(1)configure:error: Cannot build Tcl/Tk apps, probably due to misconfigured ormissing X11 headers or libs. Check config.log for more info!
安裝doxygenimagemagick
如果有yum并且能用的話,可以執行
$yuminstall doxygen
類似的指令把以上的安裝包裝了,如果有安裝碟則可以在安裝碟中将以下幾個rpm拷貝到電腦中安裝,或者到清華大學的ftp中找,裡面有,位址是ftp3.tsinghua.edu.cn。
doxygen-1.4.6-3.i386.rpm
doxygen-doxywizard-1.4.6-3.i386.rpm
ImageMagick-6.2.5.4-4.2.1.i386.rpm
ImageMagick-c++-6.2.5.4-4.2.1.i386.rpm
ImageMagick-c++-devel-6.2.5.4-4.2.1.i386.rpm
ImageMagick-devel-6.2.5.4-4.2.1.i386.rpm
ImageMagick-perl-6.2.5.4-4.2.1.i386.rpm
(2)configure:error: Cannot build Tcl/Tk apps, probably due to misconfigured ormissing X11 headers or libs. Check config.log for more info!
未安裝tcl或者tk,可以用yum安裝也可以上清華找,也可以在安裝盤裡面找下面幾個rpm。
tcl-8.4.12-4.i386.rpm
tcl-devel-8.4.12-4.i386.rpm
tcl-html-8.4.12-4.i386.rpm
tk-8.4.12-1.2.i386.rpm
tk-devel-8.4.12-1.2.i386.rpm
安裝。
(3)configure:error: Tcl/Tk not found, needed for all GUI parts. Version 8.4.0+ anddevel package required. Check config.log for more info!
在configure.user中加入
TK_CFLAGS=”-I/usr/include/tcl8.4-fwritable-strings”
TK_LIBS=”-L/usr/lib -ltk8.4-ltcl8.4 -I/usr/lib”
(4)或許你還需要以下程式,不過很大部分在安裝系統時已經帶了,以防萬一,下來裝了吧。
bison-2.1-1.2.1.i386.rpm
bison-devel-2.1-1.2.1.i386.rpm
bison-runtime-2.1-1.2.1.i386.rpm
boost-1.33.1-5.i386.rpm
boost-devel-1.33.1-5.i386.rpm
boost-doc-1.33.1-5.i386.rpm
byacc-1.9-29.2.1.i386.rpm
flex-2.5.4a-37.4.i386.rpm
giftrans-1.12.2-19.i386.rpm
libxml2-2.6.23-1.2.i386.rpm
libxml2-devel-2.6.23-1.2.i386.rpm
libxml2-python-2.6.23-1.2.i386.rpm
4.至此,如果你在XWindows下邊configure那麼就可以通過了!下面是我的結果:
[[email protected]]# ./configure
checkingbuild system type… i686-pc-linux-gnu
checkinghost system type… i686-pc-linux-gnu
configure:———————————————–
configure:reading configure.user for your custom settings
configure:———————————————–
checkingfor icc… no
checkingfor gcc… gcc
……………………………………..(省略了很多)…………………………..
configure:WARNING: Cannot compile or link program with BLT: BLT or BLT-develmay not be installed — check config.log for details. Plove andScalars require BLT to build.
……………………………………..(省略了很多)…………………………..
config.status:creating samples/queues/Makefile
config.status:creating samples/tictoc/Makefile
config.status:creating samples/tokenring/Makefile
config.status:creating samples/sockets/Makefile
config.status:creating test/Makefile
WARNING:The configuration script could not detect the following packages:
Graphviz BLT MPI (optional) Akaroa (optional)
Scrollup to see the warning messages (use shift+PgUp key), and seeconfig.log
formore details. While you can use OMNeT++/OMNEST in the current
configuration,please be aware that some functionality may be unavailable
orincomplete.
YourPATH contains /root/omnetpp/bin. Good!
YourLD_LIBRARY_PATH is set. Good!
TCL_LIBRARYis set. Good!
[[email protected]]#
之是以會出現幾個warning,是因為MPI 和Akaroa沒有安裝,不過沒有什麼大礙,因為是可選項目。你可以下載下傳并安裝消除warning。
6.好了,最後一步
[[email protected]]#make
………………(一大堆資訊)…………………
至此安裝成功了。
7。運作
[[email protected]]#cd /root/omnetpp-3.3/samples/dyna
[[email protected]]#./dyna
或許你的會出現這個提示:errorwhile loading shared libraries /root/omnetpp/lib/libnedxml.so cannotrestore segment prot after reloc:
關閉SELinux就好了,把selinux的值改成Permissive
再次運作。