[Ns-developers] Build Seems to be Broken

Gustavo Carneiro gjcarneiro at gmail.com
Tue Jul 22 03:16:38 PDT 2008


2008/7/22 <craigdo at ee.washington.edu>:

> Hi all,
>
> The python part of the build for ns-3-dev seems to be broken.  It's not a
> fatal error since I can always ./waf --python-disable and ignore ./waf
> check, (and I can also manually edit bindings to fix it -- see below)
> however, what I see is
>
> > hg clone http://code.nsnam.org/ns-3-dev
> > cd ns-3-dev
> > ./waf -d debug configure
> > ./waf - j 4
> [ ... ]
> debug/bindings/python/ns3_module_helper.cc: In function â?~PyObject*
> _wrap_PyNs3
> PointToPointHelper_SetDeviceParameter(PyNs3PointToPointHelper*, PyObject*,
> PyObj
> ect*)â?T:
> debug/bindings/python/ns3_module_helper.cc:864: error: â?~PyErr_WarnExâ?T
> was no
> t declared in this scope
> debug/bindings/python/ns3_module_helper.cc: In function â?~PyObject*
> _wrap_PyNs3
> PointToPointHelper_SetChannelParameter(PyNs3PointToPointHelper*, PyObject*,
> PyOb
> ject*)â?T:
> debug/bindings/python/ns3_module_helper.cc:903: error: â?~PyErr_WarnExâ?T
> was no
> t declared in this scope
> [ ...]
>
> This is the change from Parameter to Attribute in the point-to-point-helper
> that was made earlier this month rearing its evil head.
>
> If I manually remove the offending binding commands from
> bindings/python/ns3_module_helper.py (there are existing Set*Attribute
> versions):
>
>    ## point-to-point-helper.h: void
> ns3::PointToPointHelper::SetDeviceParamete\
> r(std::string name, ns3::AttributeValue const & value) [member function]
>    cls.add_method('SetDeviceParameter',
>                   'void',
>                   [param('std::string', 'name'),
> param('ns3::AttributeValue&',\
>  'value', is_const=True)],
>                   deprecated=True)
>    ## point-to-point-helper.h: void
> ns3::PointToPointHelper::SetChannelParamet\
> er(std::string name, ns3::AttributeValue const & value) [member function]
>    cls.add_method('SetChannelParameter',
>                   'void',
>                   [param('std::string', 'name'),
> param('ns3::AttributeValue&',\
>  'value', is_const=True)],
>                   deprecated=True)
>
> It works just fine.  I don't want to add back the SetDeviceParameter and
> SetChannelParameter with __attribute__ (deprecated) since the compiler on
> ns-regression (and my max) don't support it.
>
> If I do a ./waf --python-scan to try and rescan the bindings, it looks like
> the xml parser dies a horrible death:
>
> /home/craigdo/repos/ns-3-dev/build/debug/ns3/attribute-list.h:88:
> AnnotationsWar
> ning: Annotation 'caller_owns_return=false' not used (used in static
> ns3::Attrib
> uteList * ns3::AttributeList::GetGlobal() [member function])
>  static AttributeList *GetGlobal (void);
> Traceback (most recent call last):
>  File "/home/craigdo/repos/ns-3-dev/bindings/python/ns3modulescan.py", line
> 276
> , in ?
>    ns3_module_scan(sys.argv[1], sys.argv[3], sys.argv[2])
>  File "/home/craigdo/repos/ns-3-dev/bindings/python/ns3modulescan.py", line
> 267
> , in ns3_module_scan
>    module_parser.scan_functions()
>  File
> "/home/craigdo/repos/ns-3-dev/bindings/python/pybindgen/pybindgen/gccxmlp
> arser.py", line 1586, in scan_functions
>    self._scan_namespace_functions(self.module, self.module_namespace)
>  File
> "/home/craigdo/repos/ns-3-dev/bindings/python/pybindgen/pybindgen/gccxmlp
> arser.py", line 1737, in _scan_namespace_functions
>    func_wrapper = module.add_function(fun.name, return_type, arguments,
> **kwarg
> s)
>  File
> "/home/craigdo/repos/ns-3-dev/bindings/python/pybindgen/pybindgen/module.
> py", line 396, in add_function
>    func = Function(*args, **kwargs)
>  File
> "/home/craigdo/repos/ns-3-dev/bindings/python/pybindgen/pybindgen/functio
> n.py", line 57, in __init__
>    assert isinstance(function_name, str)
> AssertionError


This is the old problem of, on your system, pygccxml giving me unicode
identifiers.  I am unable to reproduce that problem, unfortunately, so
things are likely to get broken repeatedly.

My advice for now is, don't scan API definitions.  I'll take care of it.  Or
else report pybindgen bugs as you detect them and I'll fix it (in this case
it's just a matter of handling unicode identifiers and converting them to
ascii).


>
>
> Question:  What is the preferred way to fix something like this?  The last
> I
> heard, the solution was to tell Gustavo and he'll take care of it.  If the
> build is broken, can I just check in a change to ns3_module_helper.py to
> get
> it working for the nightly build, or is that a bad plan.


OK, the fundamental problem is that the build fails because of the error
"PyErr_WarnEx was not declared in this scope".  This is the case of
PyBindGen generating code that does not want to compile with your Python
version.

But my excuse is that the Python documentation is to be blamed here.
Documentation for PyErr_Warn [1] says "Deprecated; use PyErr_WarnEx()
instead.".  But documentation for PyErr_WarnEx [2] does not warn about this
API being introduced in Python X.Y or whatever, so I assumed it worked for
all Python versions.

I think replacing PyErr_WarnEx with PyErr_Warn should fix the problem.  In
the mean time, I think I will manually compile Python 2.3 on my system
(ubuntu no longer has it) in order to better test compatibility with that
old Python version.

Finally, my slow response time to fix this problem is due to the fact daily
regression test emails not providing me with enough information.  It is not
enough to know that something failed.  I want to see the stderr/stdout of
the failed build command in the email, because I am way too lazy to ssh into
the regression host and manually run the build myself.

[1] http://docs.python.org/api/exceptionHandling.html#l2h-113
[2] http://docs.python.org/api/exceptionHandling.html#l2h-112
-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list