Satyam Kapoor
Satyam Kapoor

Reputation: 11

Installing Network Simulator 2 on manjaro system

I tried to install ns2 on 4.9.68-1-MANJARO but got this error

    mdart/mdart_adp.cc:396:21: error: reference to ‘hash’ is ambiguous
  nsaddr_t dstAdd_ = hash(mdart_->id_);
                     ^~~~
In file included from ./mdart/mdart.h:52:0,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
./mdart/mdart_function.h:230:17: note: candidates are: nsaddr_t hash(nsaddr_t)
 inline nsaddr_t hash(nsaddr_t id) {
                 ^~~~
In file included from /usr/include/c++/7.2.1/bits/basic_string.h:6575:0,
                 from /usr/include/c++/7.2.1/string:52,
                 from /usr/include/c++/7.2.1/bitset:47,
                 from ./mdart/mdart_function.h:62,
                 from ./mdart/mdart.h:52,
                 from ./mdart/mdart_adp.h:51,
                 from mdart/mdart_adp.cc:47:
/usr/include/c++/7.2.1/bits/functional_hash.h:58:12: note:                 template<class _Tp> struct std::hash
     struct hash;
            ^~~~
make: *** [Makefile:94: mdart/mdart_adp.o] Error 1
Ns make failed!

I changed line 137 from

void eraseAll() {erase(baseMap::begin(), baseMap::end()); }

to

void eraseAll() { baseMap::erase(baseMap::begin(), baseMap::end()); } 

but, still got the same error. Please help me.

Upvotes: 1

Views: 2155

Answers (4)

Aszad Rakin
Aszad Rakin

Reputation: 46

You can follow this, worked for EndeavourOS

https://github.com/rakin000/ns2installation-archlinux

Install ns-2.35 and nam-1.15 on ArchLinux(EndeavourOS)

Install gcc-4.8

  • If you don't have 'yay', install it.
       git clone https://aur.archlinux.org/yay.git
    
    • Change directory and install
       cd yay
       makepkg -si
    
  • Now install gcc-4.8
       yay -S gcc48 
    

Download ns-allinone-2.35_gcc5.tar.gz

  • Extract and change directory
      tar -xf ns-allinone-2.35_gcc5.tar.gz 
      cd ns-allinone-2.35/
    

Install nam-1.15 and ns-2.35

  • First install dependencies
   sudo pacman -S libx11 libxmu
  • To install, run
    export CC=gcc-4.8 CXX=g++-4.8 && ./install 
  • After this script runs successfully
    • Change directory to nam-1.15 and install
       cd nam-1.15/
       sudo make install 
    
    • Change directory to ns-2.35 and install
        cd ../ns-2.35/
        sudo make install
    

Upvotes: 0

Aryan
Aryan

Reputation: 1

At the time of writing, there is a package in the package manager named "ns". It is of the same version, i.e. 2.35-9 available in the AUR. It got installed without any hassle and flaw for me.

Do give it a try.

Upvotes: 0

Rakesh S R
Rakesh S R

Reputation: 69

We have to edit source code of ns-allinone-2.35 . It contains some errors there :

In ns-allinone-2.35/ns-2.35/mdart/ we have to edit 3 files

  • 1st file is mdart_function.h , At line number 230 rename hash to hash_
  • 2nd file is mdart_adp.cc , at line number 108 and 396 rename hash to hash_ .

Reason why we need to change hash to hash_ is.! , hash is STL library utility , so it will directly refers to STL std::hash . so that I renamed hash to hash_

  • 3rd file is mdart_function.h , at line number 48 rewrite line like this #define __mdart_rqueue_h__ .

Reason is , If we are writing header file then 1st we have to write like,

#ifdefn __filename_h__
#define __filename_h__

in filename.h only .

Now In ns-allinone-2.35/ns-2.35/linkstate/ we have to edit ls.h file

  • At line number 64 rewrite like #ifndef __ls_h__ and 65 should be like #define __ls_h__

That's all. After this go head to install .

Upvotes: 1

Knud Larsen
Knud Larsen

Reputation: 5909

I changed the line 7 of otcl-1.14/Makefile.in to CC= gcc-4.9.3

The most important gcc component here is g++.

Building ns-2.35 with gcc-4.9.3 / g++-4.9.3 :

$ tar xvf ns-allinone-2.35_gcc5.tar.gz
$ cd ns-allinone-2.35/
$ export CC=gcc-4.9.3 CXX=g++-4.9.3 && ./install
$ cd ns-2.35/
# make install
                  // 'make install' will copy 'ns' to /usr/local/bin/
# cd ../nam-1.15/
# make install && exit

Note : The (temporary) export command will take care that the main applications in ns-allinone are compiled with gcc-4.9.3 / g++-4.9.3 : tcl, tk, otcl, tclcl, ns-2.35, nam-1.15 . When exiting the terminal, the export command is cancelled.


EDIT Aug 31, 2020 : gcc49-bin-4.9.3-el6.tar.xz is available https://drive.google.com/file/d/1w0jT6q59rfZ-Bl--G5Y6jRVjjxu4CH68/view?usp=sharing

cd /usr/local/
# tar xvf gcc49-bin-4.9.3-el6.tar.xz
# cd bin/
# ln -s ../gcc493/bin/gcc49
# ln -s ../gcc493/bin/g++49

Upvotes: 1

Related Questions