我下载了网络模拟器 NS-2从这里 -
http://www.isi.edu/nsnam/ns/ns-build.html#allinone
建造纳秒通过GCC 4.2.2-
tar-xzf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install
获取错误信息 -
make: *** [tk3d.o] Error 1
tk8.5.10 make failed! Exiting ...
For problem with Tcl / Tk see http://www.scriptics.com
我传递了链接 - Scriptics.com - 那里有一条消息 - “脚本档案库正在重建。请尽快回来。”
然后我尝试 -
cd ns-allinone-2.35/ && export CC=gcc-4.2 CXX=g++-4.2 && ./install
收到以下消息 -
================================
* Build tcl8.5.10
================================
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.2
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See 'config.log' for more details
tcl8.5.10 configuration failed! Exiting...
Tcl is not part of the ns project. Please see www.Screeptics.com
to see if they have a fix for your platform.
如何正确构建NS-2在Linux的Mandriva?
我更新了海湾合作委员会至版本GCC-4.7.2,然后安装ns-2.34. 之前对源代码做了一些修改 -
在mac/mac-802_Ext.h(或在mac-802_11Ext.h为了ns 2.35),第 65 行 - 添加
# include "cstddef";
也包含在文件中链接状态/ls.h在第 137 行替换 -
void eraseAll () {erase (baseMap :: begin (), baseMap :: end ());}
到
void eraseAll () {this-> erase (baseMap :: begin (), baseMap :: end ());}
现在让我们进行一个简单的测试(ns-简单.tcl) -
#Create a simulator object
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}
#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
运行(根据http://networksimulator2.files.wordpress.com/2010/10/faqtroubleshootinginstallation_problems.pdf) -
export DISPLAY localhost:6000
ns ns-simple.tcl
输出 -
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# _X11TransSocketINETConnect() can't get address for http://localhost:12000: Name or service not known
nam: couldn't connect to display "http://localhost:6000"
这是什么意思?如何获取图像?
下一步。如果我指向知识产权我安装的远程服务器ns-2,我收到以下错误 -
[root@localhost ...]# export DISPLAY=..ip_of_remote_server_:0.0
[root@localhost ...]# ns ns-simple.tcl
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# Xlib: connection to "ip_of_remote_server_:0.0" refused by server
Xlib: No protocol specified
nam: couldn't connect to display "ip_of_remote_server_:0.0"
答案1
从您的日志来看,您似乎仅在本地主机上运行显示。我的建议是使用以下导出命令:
% export DISPLAY=:0.0
然后尝试再次运行它。我在 Ubuntu 12.10 系统上使用相同的命令,并且成功了。
答案2
关于安装,请确保您已安装构建所需的所有工具。我在 Ubuntu 10.04 上遇到了同样的问题,我发现这。
我安装的工具:
- 自动配置
- 自动制作
- 海湾合作委员会
- 克++
- 构建必需品
- libxmu-dev
- 库工具
- libxt-dev
我使用 apt-get install 安装了它们并且成功了。
祝你好运。