Building NS-3 3.26 in Mac OS X 10.13 (High Sierra)

Standard

I haven’t updated the ns-3 installation guide for Mac OS X, so I updated with most recent version of Mac OS X 10.13 (High Sierra)

1. Get the source and unarchive

cd
mkdir workspace
cd workspace
wget http://www.nsnam.org/release/ns-allinone-3.26.tar.bz2
tar xjf ns-allinone-3.26.tar.bz2

2. Install required library (except goocanvas and pygoocanvas)

brew install libxml2
# if libxml2 is installed but still shows error on installing NS-3, 
# try 'brew upgrade libxml2' without quote

# install other required library (valgrind should be manually installed)
brew install gsl libgcrypt doxygen gtk cvs unrar p7zip xz cmake bzr 

brew install python python3
pip3 install meson
brew install graphviz pygtk

# install gccxml
git clone https://github.com/gccxml/gccxml.git
cd gccxml
mkdir gccxml-build
cd gccxml-build
cmake ../
make
sudo make install
cd ../..
rm -rf gccxml

# install required python library
pip2 install pygraphviz pygccxml

# install qt4 if you want to use netanim
# https://www.nsnam.org/wiki/Installation#Mac_OS_X, step 3
brew install cartr/qt4/qt-legacy-formula

# install mercurial if you want to use it
# https://www.nsnam.org/wiki/Installation#Mac_OS_X, step 4
brew install mercurial

# install valgrind by source
xcode-select --install

git clone git://sourceware.org/git/valgrind.git
cd valgrind

# Recent version is already patched to support High Sierra, so nothing to do 
./autogen.sh
./configure
make
sudo make install

valgrind --version # just for test
cd ..

3. Install goocanvas-0.14 (It is important to use 0.14, though more recent versions are available)

wget http://ftp.gnome.org/pub/gnome/sources/goocanvas/0.14/goocanvas-0.14.tar.gz
tar xvfz goocanvas-0.14.tar.gz
rm goocanvas-0.14.tar.gz

cd goocanvas-0.14
./configure
make
sudo make install
cd ..
rm -rf goocanvas-0.14

4. Install pygoocanvas-0.14.1 (tested with goocanvas 2.0.2 from homebrew)

wget https://launchpad.net/pygoocanvas/trunk/0.14.1/+download/pygoocanvas-0.14.1.tar.gz
tar xvfz pygoocanvas-0.14.1.tar.gz

cd pygoocanvas-0.14.1
wget http://study.prl85.com/wp-content/uploads/sites/2/2015/03/install-on-mac.sh
chmod 755 install-on-mac.sh

wget http://study.prl85.com/wp-content/uploads/sites/2/2015/03/pygoocanvas-0.14.1-mac.patch
patch < pygoocanvas-0.14.1-mac.patch
./install-on-mac.sh

cd ..
rm -rf pygoocanvas-0.14.1

5. Install ns-3

cd ns-allinone-3.26
python2 ./build.py --enable-examples --enable-tests

6. Test whether ns-3 is installed properly

cd ns-3.26
./test.py

7. Execute example file to check ns-3 is working or not

cp examples/tutorial/first.cc scratch/myfirst.cc
./waf
./waf --run scratch/myfirst

Reference)
https://www.nsnam.org/docs/release/3.26/tutorial/html/getting-started.html
https://www.nsnam.org/wiki/Installation#Mac_OS_X
https://stackoverflow.com/questions/39690404/brew-install-qt-does-not-work-on-macos-sierra
http://valgrind.org/downloads/repository.html
https://stackoverflow.com/questions/13421675/make-fails-while-installing-valgrind
https://github.com/mesonbuild/meson/issues/1054
https://mithunme.wordpress.com/2012/09/11/installing-ns-3-in-ubuntu

Appendix A)
In previous guide, the list of required library was following:

brew install wget mercurial bzr boost pkg-config gtk gsl doxygen graphviz cvs unrar p7zip xz cmake gtkmm gtkmm3 pygtk

If you have problem with installing, try installing package above.

Appendix B)
To test PyViz, see link https://www.nsnam.org/wiki/PyViz for the instruction.

2 thoughts on “Building NS-3 3.26 in Mac OS X 10.13 (High Sierra)

  1. test

    brew install automake

    before autogen.sh

    NEED MORE GUIDANCE
    ## before proceeding, edit configure.ac
    ## 1. at line 157,
    ## before: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
    ## after: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-9.*)
    ## 2. at line 415,
    ## before: 16.*)
    ## after: 17.*)

    brew install wget

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.