环境:UBUNTU16.04 32位
工具:NS3最新版NS3.25
步骤:
1.NS3安装预先设置Ubuntu环境
sudo apt-get install gcc g++ Python python-dev
sudo apt-get install mercurial
sudo apt-get install bzr
sudo apt-get install gdb valgrind
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
sudo apt-get install flex bison
sudo apt-get install g++-4.4 gcc-4.4//可以不执行,因首条命令已安装
sudo apt-get install tcpdump
sudo apt-get install sqlite sqlite3 libsqlite3-dev
sudo apt-get install libxml2 libxml2-dev
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
sudo apt-get install vtun lxc
sudo apt-get install uncrustify
sudo apt-get install doxygen graphviz imagemagick
sudo apt-get install texlive texlive-pdf texlive-latex-extra texlive-generic-extra texlive-generic-recommended
sudo apt-get install texinfo dia texlive texlive-pdf texlive-latex-extra texlive-extra-utils texlive-generic-recommended texi2html //可以不执行
sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
2.安装NS3
(1)使用Mercurial:
> cd
> mkdir repos
> cd repos
> hg clone http://code.nsnam.org/ns-3-allinone
(2)直接下载tar压缩包:
> cd
> mkdir tarballs
> cd tarballs
> wget http://www.nsnam.org/release/ns-allinone-3.25.tar.bz2
> tar xvf ns-allinone-3.25.tar.bz2
其实这个不用这么麻烦,直接上ns-3的官网http://www.nsnam.org/releases/通过浏览器直接下载再解压就是。
3.编译安装
在终端进入解压缩文件夹ns-allinone-3.25,并执行sudo ./build.py
进入ns-3.25//而非ns-allinone-3.25
sudo ./waf -d optimized configure
sudo ./waf -d debug configure
sudo ./waf
sudo ./waf -d --enable-sudo configure
4.检测
sudo ./test.py –c core
会出现一串PASS...
5.运行小例程
sudo ./waf --run hello-simulator
会打印"hello simulator"
问题:
在配置环境时:
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
在安装时出现:
libgsl0ldbl,但是它被其它的软件包引用了。 这可能意味着这个缺失的软件包可能已被废弃, 或者只能在其他发布源中找到 然而下列软件包会取代它:libgsl2 libgsl2:i386
的报错,通过http://packages.ubuntu.com/网站查询最近几年12.04/14.04/16.04在libgsl0ldbl软件包(GNU科学库的包)情况,发现:所涉及打三个包各版本定义如下:
Package gsl-bin:
precise (12.04LTS) (math): GNU Scientific Library (GSL) -- binary package [universe]
1.15+dfsg-1build1: amd64 armhf i386 powerpc
trusty (14.04LTS) (math): GNU Scientific Library (GSL) -- binary package [universe]
1.16+dfsg-1ubuntu1: amd64 arm64 armhf i386 powerpc ppc64el
xenial (16.04LTS) (math): GNU Scientific Library (GSL) -- binary package [universe]
2.1+dfsg-2: amd64 arm64 armhf i386 powerpc ppc64el s390x
yakkety (16.10) (math): GNU Scientific Library (GSL) -- binary package [universe]
2.1+dfsg-2: amd64 arm64 armhf i386 powerpc ppc64el s390x
Package libgsl-dev
precise (12.04LTS) (libdevel): GNU Scientific Library (GSL) -- development package
1.15+dfsg-1build1: amd64 armhf i386 powerpc
trusty (14.04LTS) (libdevel): GNU Scientific Library (GSL) -- development package
1.16+dfsg-1ubuntu1: amd64 arm64 armhf i386 powerpc ppc64el
xenial (16.04LTS): Virtual package
provided by: libgsl-dev
yakkety (16.10): Virtual package
provided by: libgsl-dev
Package libgsl0ldbl
precise (12.04LTS) (math): GNU Scientific Library (GSL) -- library package
1.15+dfsg-1build1: amd64 armhf i386 powerpc
trusty (14.04LTS) (math): GNU Scientific Library (GSL) -- library package
1.16+dfsg-1ubuntu1: amd64 arm64 armhf i386 powerpc ppc64el
可以发现前两个包三个版本都有并且同包名,所以在我UBUNTU16.04上前两个包不报错,但三因为libgsl0ldbl这个包UBUNTU16.04没有,所有报错,仔细查可以看到:
Package libgsl2
xenial (16.04LTS) (libs): GNU Scientific Library (GSL) -- library package
2.1+dfsg-2: amd64 arm64 armhf i386 powerpc ppc64el s390x
yakkety (16.10) (libs): GNU Scientific Library (GSL) -- library package
2.1+dfsg-2: amd64 arm64 armhf i386 powerpc ppc64el s390x
实质上就是以往UBUNTU版本里打libgsl0ldbl,故
sudo apt-get install gsl-bin libgsl0-dev libgsl2
即可。