Search code examples
pythonc++ns-3waf

NS-3 ImportError: No module named cflags


I'm trying to run compile and build an NS-3 project using ./waf in Ubuntu 18.04, but I'm receiving the following error message:

Waf: The wscript in '/home/user/workspace/ns3-802.11ad' is unreadable
Traceback (most recent call last):
  File "/home/user/workspace/ns3-802.11ad/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Scripting.py", line 100, in waf_entry_point
    set_main_module(os.path.normpath(os.path.join(Context.run_dir,Context.WSCRIPT_FILE)))
  File "/home/user/workspace/ns3-802.11ad/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Scripting.py", line 125, in set_main_module
    Context.g_module=Context.load_module(file_path)
  File "/home/user/workspace/ns3-802.11ad/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Context.py", line 354, in load_module
    try:exec(compile(code,path,'exec'),module.__dict__)
  File "/home/user/workspace/ns3-802.11ad/wscript", line 53, in <module>
    import cflags # override the build profiles from waf
ImportError: No module named cflags

could anybody help me out?


Solution

  • It seems to me that your download was corrupted somehow. Try again, and check that the following holds true:

    arshad@a4arshad:~/Downloads$ md5sum ns-allinone-3.29.tar.bz2 
    1f4b667035fdb79471c7319f38595289  ns-allinone-3.29.tar.bz2
    arshad@a4arshad:~/Downloads$ ls -l ns-allinone-3.29
    total 36
    drwxr-xr-x  6 arshad arshad 4096 Mar 30 16:57 bake
    -rwxr-xr-x  1 arshad arshad 5940 Sep  5  2018 build.py
    -rw-r--r--  1 arshad arshad  575 Sep  5  2018 constants.py
    drwxr-xr-x  3 arshad arshad 4096 Mar 30 16:57 netanim-3.108
    drwxr-xr-x 10 arshad arshad 4096 Mar 30 16:57 ns-3.29
    drwxr-xr-x 10 arshad arshad 4096 Mar 30 16:57 pybindgen-0.17.0.post58+ngcf00cc0
    -rw-r--r--  1 arshad arshad  924 Sep  5  2018 README
    -rw-r--r--  1 arshad arshad  561 Sep  5  2018 util.py
    

    Or you can try this:

    ./waf distclean
    ./waf configure
    ./waf