手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

ns2.34_Ubuntu安装记录

[日期:2010-07-05] 来源:Linux社区  作者:jzhwang2008 [字体:大 中 小]
原先是在win_cygwin下安装的,还是比较顺,基本没出问题。最近VisualBox+Ubuntu玩玩看,准备在上面安装NS2,顺便学习一下Linux。

学习需要2.31,安装有问题,没仔细看出错信息,otcl有误,鲁莽认为版本有问题,下ns2.34,目前最新,09年。估计ns3风生水起,2停止release了。

转入正题。
$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.34.tar.gz
$ tar -xzvf ns-allinone-2.34.tar.gz
$ cd ns-allinone-2.34
$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ ./install
安装同样是在进行中,OTCL出错,退出,原因未知(“otcl-1.13 make failed! Exiting …”不知其所以然,google之)
解决方法:
ns-allinone-2.34/ns-2.34中找到  Makefile.in,修改

CC = @CC@                改为      CC = gcc-4.3
CPP = @CXX@            改为      CPP = g++-4.3

OS中有gcc,g++ ?
$ sudo apt-get install g++-4.3
$ CC=gcc-4.3 CXX=g++-4.3 ./install

执行。。。。。。
中间没看清,./install 重新工作,安装结束, 对Linix机理还是不清楚,www.linuxidc.com惭愧!

修给环境变量:
$ gedit ~/.bashrc
末尾添加:
# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your/path/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/your/path/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your/path/ns-allinone-2.34/bin:/your/path/ns-allinone-2.34/tcl8.4.18/unix:/your/path/ns-allinone-2.34/tk8.4.18/unix
NS=/your/path/ns-allinone-2.34/ns-2.34/
NAM=/your/path/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM
为使修改的环境变量立即生效,执行
$ source ~/.bashrc

至此ok

$ns

% 出现,证明一切彻底ok

试了一个例子通过。

转: eclipse调试ns程序
Eclipse

Open Eclipse
Set the workspace as the ns installation path( /home/username/ns-allinone-2.34 ) by selecting File -> Switch Workspace
Choose File -> New -> Project -> C++ Project
Select Project Type as Makefile Project -> Empty C++ Project.
Toolchains: Linux GCC
Enter Project Name as ns-2.34
Uncheck “Use default location” then browse to the directory NS-2 source directory ( …/ns-allione-2.34/ns-2.34 )
Select “Next” and “Finish.
From the workspace, Selecting the NS-2 Project and choosing Project -> Build All should not give Error.
Running the project must open the console with the NS-2 prompt, %
Setting Debug Configuration:

Select Run -> Debug Configurations
Choose C/C++ Application. Type in any name.
Under the Main tab, Choose the following:
Project as ns-2.34.
C/C++ Application as ns. (Search Project and Choose this)
Under the Debugger tab, choose GDB Debugger. Uncheck the “Stop on startup at” option.
Apply and Debug. 

linux
相关资讯       Ubuntu知识  ns 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款