NS3 Aqua-sim之一:安装

NS3 Aqua-sim之一:安装

环境:

Ubuntu 18.04.6 LTS
gcc version 7.3.0
NS-3.26

第一种方式

下载:

Download | ns-3 (nsnam.org)

安装 Aqua-sim 需要ns-3.26版本,亲测3.3以上编译会报错

下载后放入 /home/用户名 目录下即可,随后解压到当前目录

安装 NS3:

创建setup文件

#!/bin/sh
sudo apt-get install gcc g++ python -y
sudo apt-get install gcc g++ python python-dev -y
sudo apt-get install mercurial -y
sudo apt-get install bzr -y
sudo apt-get install gdb valgrind -y
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl -y
sudo apt-get install flex bison libfl-dev -y
sudo apt-get install g++-3.4 gcc-3.4 -y
sudo apt-get install tcpdump -y
sudo apt-get install aqlite aqlite3 libsqlite3-dev -y
sudo apt-get install libxml2 libxml2-dev -y
sudo apt-get install libgtk2.0-0 libgtk2.0-dev -y
sudo apt-get install vtun lxc -y
sudo apt-get install uncrustify -y
sudo apt-get install doxygen grphviz imagemagick -y
sudo apt-get install texlive texlive-extra-untils texlive-latex-extra -y
sudo apt-get install python-sphinx dia -y
sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev -y
sudo apt-get install libboost-signals-dev libboost-filesystem-dev -y
sudo apt-get install openmpi* -y

保存脚本文件,加权限并运行

chmod +x setup
./setup

切换到NS3解压目录

./build.py

下载 Aqua-sim

rmartin5/aqua-sim-ng: Aqua-Sim on NS3 (github.com)

下载后将此文件解压到 NS-3.26/src 目录中

编译

直接编译可能会出错:

../src/network/model/node.cc: In static member function ‘static ns3::TypeId ns3::Node::GetTypeId()’:
../src/network/model/node.cc:70:48: error: enum constant in boolean context [-Werror=int-in-bool-context]
                    TypeId::ATTR_GET || TypeId::ATTR_SET,
                                                ^~~~~~~~
cc1plus: all warnings being treated as errors

使用以下编译命令即可:

./waf clean; CXXFLAGS="-O3" ./waf configure; ./waf


第二种方式:吉林大学智慧海洋实验室项目开源页面

下载 ns3.27 文件

第三代水声网络模拟器Aqua-Sim-TG页面下载aquasim,并解压。

cd ns3.27/
CXXFLAGS="-Wno-error" ./waf configure --build-profile=debug --enable-examples --enable-tests

# 注意:“--enable-examples”和“--enable-tests”之前分别有一个空格。

在ns3.27目录下编译运行

./waf
./waf --run hello-simulator

安装Aqua-Sim-tg模块

吉林大学智慧海洋实验室项目开源页面下载Aqua-Sim-TG 21.9.28

解压 Aqua-Sim-TG 21.9.28.zip

ns3.27/src 目录下删除 aqua-sim-ng ,并复制粘贴 aqua-sim-tgns3.27/src

ns3.27 目录下删除 build 目录

cd ns3.27/
CXXFLAGS="-Wno-error" ./waf configure --build-profile=debug --enable-examples --enable-tests
./waf
./waf --run hello-simulator

# 注意:“--enable-examples”和“--enable-tests”之前分别有一个空格。

原文链接


NS3 Aqua-Sim-TG 学习记录

安装 netanim 可视化

下载

sudo apt-get install mercurial
sudo apt-get install qt4-dev-tools
hg clone http://code.nsnam.org/netanim

编译

cd netanim
make clean
qmake NetAnim.pro
make

使用

cd netanim
./NetAnim

运行实例产生 .xml 文件供 NetAnim 解析

./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"

这两个命令需要进入到目录 src/netanim/examples ,若出现"权限不够"问题,cd到ns-3.*目录执行下面命令

./waf --run "src/netanim/examples/dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"
./waf --run "src/netanim/examples/grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"

原文链接


netanim遇到的问题

X Error: BadAccess (attempt to access private resource denied) 10
  Extension:    130 (MIT-SHM)
  Minor opcode: 1 (X_ShmAttach)
  Resource id:  0x152
  
# 并且运行netanim时只有程序不显示按钮

解决方案:

sudo vi /etc/environment

末尾添加

QT_X11_NO_MITSHM=1

保存之后,运行 source /etc/environment 之后还是不行就重启一次

原文链接


posted @   cccht  阅读(527)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示