3

I'm trying to install ns-3 network simulator, and I'm building a simple script that would install all prerequisites on fresh install of latest Ubuntu LTS OS(18.04).

Everything goes smooth but once I try to run any test, I get following error:

Traceback (most recent call last):   
 File "./source/ns-3.29/test.py", line 1942, in <module>
   sys.exit(main(sys.argv))   
 File "./source/ns-3.29/test.py", line 1939, in main
   return run_tests()   
 File "./source/ns-3.29/test.py", line 1010, in run_tests
   read_waf_config()   File "./source/ns-3.29/test.py", line 579, in read_waf_config
   for line in open(".lock-waf_" + sys.platform + "_build", "rt"): 
 IOError: [Errno 2] No such file or directory: '.lock-waf_linux2_build'

This also happens when I try simply: ./waf --help

Script doesn't do anything spectacular, but here it is just in case. It has to be invoked using sudo

#!/bin/bash
echo "Installing..."

#   basic OS update
apt update
apt upgrade -y
apt dist-upgrade -y
apt autoremove -y
apt autoclean -y

#   install prerequisites
apt install git -y
apt install gcc -y
apt install g++ -y
apt install mercurial -y
apt install cvs -y
apt install bzr -y
apt install make -y
apt install cmake -y
apt install qt5-default -y
apt install qtcreator -y
apt install python-gi-cairo -y
apt install gir1.2-goocanvas-2.0 -y
apt install python-pygraphviz -y
apt install python-dev -y
apt install python-setuptools -y

##  acquire Bake
git clone https://gitlab.com/nsnam/bake

#   add Bake to PATH
export BAKE_HOME=`pwd`/bake 
export PATH=$PATH:$BAKE_HOME
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME

#   check if all valid
bake.py check

#   configure Bake for ns-3
bake.py configure -e ns-3.29
bake.py show

#   download and build ns-3
bake.py download
cd ./source/ns-3.29/ && ./waf configure && cd ../../
bake.py build
#instead of 3 lines above this comment there was previously just "bake.py deploy"

./source/ns-3.29/test.py #this causes an error

echo "Finished Install!"

./waf configure gives following output: output (pastebin)

Rorschach
  • 734
  • 2
  • 7
  • 22
  • try installing `pkg-config` then configure again. Your `./waf configure` showed that you did not install. I had problems with that in the past – thenewjames May 20 '19 at 14:03

2 Answers2

3

ns-3 bundled waf in the distribution. When you build from scratch, the first thing you want to do is to run ./waf configure so that you have the waf module unpacked to a directory named like waf3-2.0.15-ff6573b86ad5ff5d449c8852ad58b8bc. The missing Scripting is supposed to be the file waf3-2.0.15-ff6573b86ad5ff5d449c8852ad58b8bc/waflib/Scripting.py

I don't know what went wrong as you didn't provide enough clue. But check if you have the directory I mentioned above in the ns3 directory, if so, delete it then run ./waf configure again.

adrtam
  • 6,991
  • 2
  • 12
  • 27
  • It seems that somehow waf didn't get to configure. If you look at the updated question, I have invoked `./waf configure` manually and provided its output. Still once I try to run tests I get an error. – Rorschach May 15 '19 at 17:31
2

try to run the same command using sudo. It worked for me.

  • From Review: Hi, this post does not seem to provide a [quality answer](https://stackoverflow.com/help/how-to-answer) to the question. Please either edit your answer and improve it, or just post it as a comment. – sɐunıɔןɐqɐp Nov 02 '19 at 10:49