Ubuntu 安装 NS3 Aqua-sim模块


Ubuntu 安装 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 mysetup
./mysetup

切换到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