Ubuntu12.04中安装ns-allinone-2.34
1、首先安装ns2所需的组件、库之类:
$sudo apt-get update
$sudo apt-get install build-essential
$sudo apt-get install tcl8. tcl8.-dev tk8. tk8.-dev
$sudo apt-get install libxmu-dev libxmu-headers
2、查找包含x11-dev关键字的软件包,以防出现类似tk8.4.14,安装中断退出:
$sudo apt-cache search x11-dev
出现如下类似的命令:
ibx11-dev - X11 client-side library (development headers)
xlibs-dev - X Window System client library development files transitional package
libghc6-x11-dev - Haskell X11 binding for GHC
libooc-x11-dev - X11 specific modules for the oo2c compiler (devel)
libgl1-mesa-swx11-dev - A free implementation of the OpenGL API -- development support files
则分别安装上面的组件,命令如下:
$sudo apt-get install libx11-dev
$sudo apt-get install xlibs-dev
$sudo apt-get install libghc6-x11-dev
$sudo apt-get install libooc-x11-dev
3、编译ns2之前先修改两个地方(针对ununtu9.04以后的版本):
输入cd otcl-1.13,进入otcl-1.13目录,找到configure.in.将77行,SHLIB_LD="ld -shared"改为 SHLIB_LD="gcc -shared"
同时修改configure 第6304行SHLIB_LD="ld -shared"改为SHLIB_LD="gcc -shared"
4、先在otcl-1.13和tclcl8.4.18目录分别./configure make 之后再在/ns-2.34目录下./configure make,make完了之后一定记得sudo make install:
$sudo make install
这样保证在ns-2.34目录下./configure生成的Makefile中LIB的路径都是/home/muye/ns-allinone-2.34/下的otcl、tclcl
5、增添环境变量:
$sudo gedit /etc/profile
追加如下:
# NS-2.34
export PATH=/home/muye/ns-allinone-2.34/bin:/home/muye/ns-allinone-2.34/tcl8.4.18/unix:/home/muye/ns-allinone-2.34/tk8.4.18/unix:$PATH
export LD_LIBRARY_PATH=/home/muye/ns-allinone-2.34/otcl-1.13:/home/muye/ns-allinone-2.34/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=/home/muye/ns-allinone-2.34/tcl8.4.18/library:$TCL_LIBRARY
6、在/ns-2.34目录下./configure make完了之后一定记得sudo make install:
$sudo make install
每次修改ns2之后重新make之后也要这样做,保证ns的最新。
7、安装nam,在nam-1.14目录下./configure make 之后,记得要修改main.cc文件,防止出现“nam: invalid command name "tcl_findLibrary"”:
#ifdef notdef
fprintf(stderr, "Application name is %s\n", appname);
#endif
-#if 0
+//#if 0
Tcl_Interp *interp = Tcl_CreateInterp();
if (Tcl_Init(interp) == TCL_ERROR) {
printf("%s\n", interp->result);
abort();
}
-#endif
+//#endif
即注释掉if 0和endif。之后sudo make install即可。
出现的问题解决:
错误一: tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’: tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’ make: *** [tools/ranvar.o]错误1 Ns make failed! See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
解决办法: 在ns-allinone-2.34/ ns-2.34/tools文件夹下,找到报错提示中的ranvar.cc文件,打开找到对应的219行删 除::GaammaRandomVariable,保存, 即:将219行的 return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_); 改为: return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_); 然后保存退出,重新安装ns2。
错误二: In file included from mac/mac-802_11Ext.cc:66:0:
mac/mac-802_11Ext.h: 在成员函数‘u_int32_t PHY_MIBExt::getHdrLen11()’中:
mac/mac-802_11Ext.h:175:19: 错误: expected primary-expression before
‘struct’ mac/mac-802_11Ext.h:175:41: 错误: ‘dh_body’在此作用域中尚未声明
mac/mac-802_11Ext.h:175:51: 错误: ‘offsetof’在此作用域中尚未声明
mac/mac-802_11Ext.h:177:3: 警告: 在有返回值的函数中,控制流程到达函数尾
[-Wreturn-type]
解决办法: 在ns-allinone-2.34 s-2.34\mac\mac-802_11Ext.h 文件添加#include
<cstddef>然后重新安装,就OK了。
错误三: mobile/nakagami.cc: 在成员函数‘virtual double
Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*)’中:
mobile/nakagami.cc:185:67: 错误:
不能直接调用构造函数‘GammaRandomVariable::GammaRandomVariable’ [-fpermissive]
mobile/nakagami.cc:185:67: 错误:
对于函数类型的类型转换,移除冗余的‘::GammaRandomVariable’ [-fpermissive]
解决办法: 在ns-allinone-2.34/ ns-2.34/
mobile文件夹下,找到报错提示中的nakagami.cc文件,打开找到对应的183行删除::ErlangRandomVariable,保存,
即:将183行的 resultPower =
ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
改为: resultPower = ErlangRandomVariable(Pr/m, int_m).value();
在ns-allinone-2.34/ ns-2.34/
mobile文件夹下,找到报错提示中的nakagami.cc文件,打开找到对应的185行删除::GammaRandomVariable,保存,
即:将185行的 resultPower = GammaRandomVariable::GammaRandomVariable(m,
Pr/m).value(); 改为: resultPower = GammaRandomVariable(m,
Pr/m).value(); 重新在ns目录下键入$
./install安装,再次出现同类问题时,仿照此次解决方法,找到对应的文件和行数,修改即可。
(注意:往往在移植到别的平台时,尤其是x86到x86_64,在/ns-2.34目录下make clean有时候并不能够全部rm掉原来32位下生成的.o、.a文件,比如我在移植到64位安装时候出现:
/usr/bin/ld: i386 architecture of input file `common/main-monolithic.o' is incompatible with i386:x86-64 output
collect2: ld returned 1 exit status
就是因为common/main-monolithic.o没有clean干净。
直接执行find . -name ".o" | xargs rm -rf)
nam出现如下问题时:
nam_stream.o: In function `NamStreamCompressedFile::gets(char*, int)':
nam_stream.cc:(.text+0x1071): undefined reference to `gzgets'
nam_stream.o: In function `NamStreamCompressedFile::NamStreamCompressedFile(char const*)':
nam_stream.cc:(.text+0x10b4): undefined reference to `gzopen'
nam_stream.o: In function `NamStreamCompressedFile::NamStreamCompressedFile(char const*)':
nam_stream.cc:(.text+0x1136): undefined reference to `gzopen'
collect2: ld returned 1 exit status
make: *** [nam] Error 1
发现rm掉.o也没用,那么:
修改nam目录下的Makefile,添加-lz
LIB = \
-L/home/hct/ns-allinone-2.31/tclcl-1.19 -ltclcl -L/home/hct/ns-allinone-2.31/otcl -lotcl -L/home/hct/ns-allinone-2.31/lib -ltk8.4 -L/home/hct/ns-allinone-2.31/lib -ltcl8.4 -lz \
再make sudo make install
nam如果出现如下问题:
make 说找不到 X11/xmu/winutil.h,安装 libXmu-dev:
sudo apt-get install libXmu-dev
nam如果出现如下问题:
执行nam提示:nam:no display name and no $DISPLAY environment variable,那么这是因为远程ssh到别的机器上无法进行图形界面,只能在那台机器上执行就好。
编译的时候出现"/usr/bin/ld: cannot find -lz"错误,需要安装zlib-dev这个包,在线安装命令为:apt-get install zlib1g-dev。
Ubuntu12.04中安装ns-allinone-2.34的更多相关文章
- 【转】在ubuntu12.04中安装wine和sourceinsight
PS: 用wine其实还可以在Linux下运行其他Windows软件,比如BeyondCompare,过程是一样的 原文网址:http://www.2cto.com/os/201408/322370. ...
- 在ubuntu12.04中安装wine和source insight
1.安装wine sudo apt-get install wine 2.安装source insight 将source insight安装的可运行文件拷贝到ubuntu中.我拷贝到了~/Deskt ...
- Ubuntu12.04中安装Oracle JDK和NetBeans的方法
1.到官网下载jdk-7u51-linux-i586.tar.gz安装包 2.创建jvm文件夹 $sudo mkdir /usr/lib/jvm 3.将安装包解压到上述文件夹下 $-linux-i58 ...
- 在ubuntu12.04上安装6款顶级漂亮的BURG主题
BURG 基本上是一个基于GRUB的Linux引导装载程序.BURG格有一个高度可配置的菜单系统,可选择文本和图形模式.简而言之,BURG可广泛定制,有良好免费的BURG主题.选择自己最喜欢的,下面我 ...
- 在Ubuntu14.04中安装Py3和切换Py2和Py3环境
前几天小编给大家分享了如何安装Ubuntu14.04系统,感兴趣的小伙伴可以戳这篇文章:手把手教你在VMware虚拟机中安装Ubuntu14.04系统.今天小编给大家分享一下在Ubuntu14.04系 ...
- Angularjs学习---ubuntu12.04中karma安装配置
Angularjs学习---ubuntu12.04中karma安装配置中常见的问题总结 karma启动时出现了很多问题: 1.安装karma前提条件 安装karma首先要安装nodejs,npm然 ...
- 在vmware 6.5+ubuntu12.04上安装VMware tools出现问题的分析
笔者已经写了一篇关于安装"VMware Tools",以实现文件共享的文章,那篇文章对于你实现共享操作是足够了, 所以,倘若你赶时间不如直接去在虚拟机的linux中利用VMware ...
- ubuntu-12.04.4-alternate-i386安装
Ubuntu-12.04.4安装 0.网络配置环境: 1. 选择中文简体. 2.选择第一个,安装ubuntu . 3.询问是否安装所选择的语言版本,选择yes. 4.选择“否”默认键盘布局,选择 no ...
- Ubuntu12.04下安装sourcenavigator-NG4.5阅读源代码
大家知道Windows下有一个很好的查看源代码的软件sourceinsight,使用sourceinsight查看Linux内核代码.嵌入式软件开发中的C语言项目源代码.驱动程序代码很是方便.在Lin ...
随机推荐
- SVG事件响应
1 UIEvents(用户界面事件) focusin(onfocusin):一个元素获得焦点(例如,一段文本被选中) focusout(onfocusout):一个元素失去焦点(例如,一段文本 ...
- 好用的ajax后台框架
dwz 简单实用的国产jquery Ui框架 http://www.j-ui.com/#_blank
- [hadoop转载]tearsort
1TB排序通常用于衡量分布式数据处理框架的数据处理能力.Terasort是Hadoop中的的一个排序作业,在2008年,Hadoop在1TB排序基准评估中赢得第一名,耗时209秒.那么Tera ...
- leecode 排列的学习
前面写过3个排列.这里再写一次. 1.全部都不重复https://oj.leetcode.com/problems/permutations/ (使用交换法)只是本人对c++ stl不熟,不会把排列结 ...
- 前端自动生成/加载CSS
前言: 1.我很懒! 2.写样式时,很多时候需要单独设置长度.宽度.内间距.外间距等.于是,就会有很多CSS代码会出现很多类似以下的代码: .w20: { width: 20px; } .mt10: ...
- modelsim使用命令
1. 常用仿真命令 vlib work // 建立work仿真库 vmap work wrok // 映射库 vlog -cover bcest *.v // 加覆盖率分析的编 ...
- Python抓取淘宝IP地址数据
def fetch(ip): url = 'http://ip.taobao.com/service/getIpInfo.php?ip=' + ip result = [] try: response ...
- WinForm TextBox自定义扩展方法数据验证
本文转载:http://www.cnblogs.com/gis-crazy/archive/2013/03/17/2964132.html 查看公司项目代码时,存在这样一个问题:winform界面上有 ...
- UDP编程
一: socket编程中的几种地址 Socket编程会遇到三种地址, 都是定义的结构体(struct): Struct in_addr { Unsigned int s_add ...
- [TypeScript] Loading Compiled TypeScript Files in Browser with SystemJS
TypeScript outputs JavaScript, but what are you supposed to do with it? This lesson shows how to tak ...