Bug 2967

Summary: ns-3.28 Waf not compatible with Python 3.7
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: build systemAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED FIXED    
Severity: normal CC: michael.rademacher, natale.patriciello, ns-bugs
Priority: P3    
Version: ns-3.28   
Hardware: All   
OS: All   

Description Tom Henderson 2018-08-08 09:02:18 UTC
Reported by Michael Rademacher:

$ ./waf configure
Traceback (most recent call last):
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Node.py", line 312, in ant_iter
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Scripting.py", line 110, in waf_entry_point
    run_commands()
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Scripting.py", line 167, in run_commands
    parse_options()
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Scripting.py", line 140, in parse_options
    Context.create_context('options').execute()
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Options.py", line 146, in execute
    super(OptionsContext,self).execute()
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Context.py", line 93, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Context.py", line 134, in recurse
    user_function(self)
  File "/path/to/ns-allinone-3.28/ns-3.28/wscript", line 144, in options
    opt.load('compiler_c')
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Context.py", line 90, in load
    fun(self)
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Tools/compiler_c.py", line 36, in options
    opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py'])
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Context.py", line 321, in load_special_tools
    lst=self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Node.py", line 361, in ant_glob
    ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=kw.get('maxdepth',25),dir=dir,src=src,remove=kw.get('remove',True))]
  File "/path/to/ns-allinone-3.28/ns-3.28/.waf3-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Node.py", line 361, in <listcomp>
    ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=kw.get('maxdepth',25),dir=dir,src=src,remove=kw.get('remove',True))]
RuntimeError: generator raised StopIteration
Comment 1 natale.patriciello 2018-08-20 08:30:16 UTC
Could we get rid of waf entirely? Or not to distribute it with ns-3, but allowing to use the installed version of waf (packaged by the distribution)
Comment 2 Michael Rademacher 2018-08-20 08:42:31 UTC
(In reply to natale.patriciello from comment #1)
> Could we get rid of waf entirely? Or not to distribute it with ns-3, but
> allowing to use the installed version of waf (packaged by the distribution)

I am currently using a python2.7 virtualenv as a workaround. Perhaps a virtualenv provides additional advantages like separation of OS and ns-3 python dependency so it is worth thinking about such a concept in general?
Comment 3 Tom Henderson 2018-08-20 13:01:49 UTC
(In reply to natale.patriciello from comment #1)
> Could we get rid of waf entirely? Or not to distribute it with ns-3, but
> allowing to use the installed version of waf (packaged by the distribution)

Waf is not in distributions (at least Debian-based systems) because the project will not agree to Debian packaging guidelines.  Waf has a 'ship the build system with the project' philosophy.  The API is not completely stable so it will probably lead to more hassle if we try to support multiple distribution-based Waf versions.
Comment 4 Tom Henderson 2018-08-20 13:05:32 UTC
(In reply to Michael Rademacher from comment #2)
> (In reply to natale.patriciello from comment #1)
> > Could we get rid of waf entirely? Or not to distribute it with ns-3, but
> > allowing to use the installed version of waf (packaged by the distribution)
> 
> I am currently using a python2.7 virtualenv as a workaround. Perhaps a
> virtualenv provides additional advantages like separation of OS and ns-3
> python dependency so it is worth thinking about such a concept in general?

Yes, virtualenv are useful; Docker containers probably even more so.

I have a patch to test; just waiting for the author's permission to post.
Comment 5 Tom Henderson 2018-08-23 23:37:00 UTC
The patches I used for the ns-3.29.rc2 release candidate are here:

https://gitlab.com/tomhenderson/ns-3-dev/commit/1a85637ece0ac621e5be154162aa7c028862e2a6

https://gitlab.com/tomhenderson/ns-3-dev/commit/93e6cb950044460e9466f614151f4ea0f0830957

Will commit to ns-3-dev if no regressions discovered.
Comment 6 Tom Henderson 2018-08-26 09:49:18 UTC
Fixed in changeset 13751:434baa130664