[Ns-developers] Python bindings failure

Gustavo Carneiro gjcarneiro at gmail.com
Fri Nov 13 07:23:51 PST 2009


2009/11/13 Faker Moatamri <faker.moatamri at sophia.inria.fr>

> Hi,
> Since the latest changes in ns-3-dev, the building with python are failing.
> The reasons are two changes:
> /Guillaume Seguin/ *Simulator::SetScheduler now takes an ObjectFactory* <
> http://code.nsnam.org/ns-3-dev/rev/915abd2b907b>
> /Mathieu Lacage/ *replace RefCountBase with SimpleRefCount<> to avoid
> duplicate refcounting implementations.* <
> http://code.nsnam.org/ns-3-dev/rev/c0ac392289c3>
> Those two gives the following errors:
> For SetScheduler changes:
>
> debug/bindings/python/ns3_module_simulator.cc: In function 'PyObject*
> _wrap_PyNs3Simulator_SetScheduler(PyNs3Simulator*, PyObject*, PyObject*)':
> debug/bindings/python/ns3_module_simulator.cc:1530: error: no matching
> function for call to
> 'ns3::Simulator::SetScheduler(ns3::Ptr<ns3::Scheduler>)'
> debug/ns3/simulator.h:84: note: candidates are: static void
> ns3::Simulator::SetScheduler(ns3::ObjectFactory)
> debug/bindings/python/ns3_module_simulator.cc: In function 'PyObject*
> _wrap_PyNs3SimulatorImpl_SetScheduler(PyNs3SimulatorImpl*, PyObject*,
> PyObject*)':
> debug/bindings/python/ns3_module_simulator.cc:5960: error: no matching
> function for call to
> 'ns3::SimulatorImpl::SetScheduler(ns3::Ptr<ns3::Scheduler>)'
> debug/ns3/simulator-impl.h:53: note: candidates are: virtual void
> ns3::SimulatorImpl::SetScheduler(ns3::ObjectFactory)
> debug/bindings/python/ns3_module_simulator.cc: In function 'PyObject*
> _wrap_PyNs3DefaultSimulatorImpl_SetScheduler(PyNs3DefaultSimulatorImpl*,
> PyObject*, PyObject*)':
> debug/bindings/python/ns3_module_simulator.cc:9888: error: no matching
> function for call to
> 'ns3::DefaultSimulatorImpl::SetScheduler(ns3::Ptr<ns3::Scheduler>)'
> debug/ns3/default-simulator-impl.h:59: note: candidates are: virtual void
> ns3::DefaultSimulatorImpl::SetScheduler(ns3::ObjectFactory)
> debug/bindings/python/ns3_module_simulator.cc: In function 'PyObject*
> _wrap_PyNs3RealtimeSimulatorImpl_SetScheduler(PyNs3RealtimeSimulatorImpl*,
> PyObject*, PyObject*)':
> debug/bindings/python/ns3_module_simulator.cc:13904: error: no matching
> function for call to
> 'ns3::RealtimeSimulatorImpl::SetScheduler(ns3::Ptr<ns3::Scheduler>)'
> debug/ns3/realtime-simulator-impl.h:69: note: candidates are: virtual void
> ns3::RealtimeSimulatorImpl::SetScheduler(ns3::ObjectFactory)
> Waf: Leaving directory
> `/home/buildslave/slave/full-rahan-g++-4.4.0/build/build'
>
> Which should be fixed by rescanning the python bindings
> For RefCountBase changes:
> debug/bindings/python/ns3_module_core.cc: In function ‘int
> _wrap_PyNs3RefCountBase__tp_init__0(PyNs3RefCountBase*, PyObject*,
> PyObject*, PyObject**)’:
> debug/bindings/python/ns3_module_core.cc:6816: error: cannot allocate an
> object of abstract type ‘ns3::RefCountBase’
> debug/ns3/ref-count-base.h:38: note: because the following virtual
> functions are pure within ‘ns3::RefCountBase’:
> debug/ns3/ref-count-base.h:43: note: virtual
> ns3::RefCountBase::~RefCountBase()
> debug/ns3/ref-count-base.h:43: note: virtual
> ns3::RefCountBase::~RefCountBase()
> debug/bindings/python/ns3_module_core.cc: In function ‘int
> _wrap_PyNs3RefCountBase__tp_init__1(PyNs3RefCountBase*, PyObject*,
> PyObject*, PyObject**)’:
> debug/bindings/python/ns3_module_core.cc:6835: error: cannot allocate an
> object of abstract type ‘ns3::RefCountBase’
> debug/ns3/ref-count-base.h:38: note: since type ‘ns3::RefCountBase’ has
> pure virtual functions
> debug/bindings/python/ns3_module_core.cc: In function ‘PyObject*
> _wrap_PyNs3RefCountBase__copy__(PyNs3RefCountBase*)’:
> debug/bindings/python/ns3_module_core.cc:6870: error: cannot allocate an
> object of abstract type ‘ns3::RefCountBase’
> debug/ns3/ref-count-base.h:38: note: since type ‘ns3::RefCountBase’ has
> pure virtual functions
>
> Which is fixed by replacing in src/core/ref-count-base.h /virtual
> ~RefCountBase () = 0; /by /~RefCountBase () ;/. Mathieu can I commit this
> change?
>
> Now the big problem that I was unable to fix for now is that after making
> the above change and after successfully scanning python bindings, I get this
> error:
> uild failed
> -> task failed (err #1):
> {task: command_task ns3modulegen.py,ns3modulegen_generated.py,.......}
>
> When I look at the log file
> less build/debug/bindings/python/ns3modulegen.log I get the following
> error:
> Traceback (most recent call last):
> File "../bindings/python/ns3modulegen.py", line 166, in <module>
> main()
> File "../bindings/python/ns3modulegen.py", line 86, in main
> register_types(root_module)
> File
> "/auto/sop-nas2a/u/sop-nas2a/vol/home_planete/fmoatamr/src/ns-3-dev/bindings/python/apidefs/gcc-LP64/ns3modulegen_generated.py",
> line 56, in register_types
> ns3_module_core.register_types(module)
> File
> "/auto/sop-nas2a/u/sop-nas2a/vol/home_planete/fmoatamr/src/ns-3-dev/bindings/python/apidefs/gcc-LP64/ns3_module_core.py",
> line 157, in register_types
> module.add_class('SimpleRefCount', template_parameters=['ns3::PbbPacket',
> 'ns3::Header'], parent=root_module['ns3::Header'])
> KeyError: 'ns3::Header'
>
> Can anyone tell me why the ns3::Header is not recognized in python
> bindings? Gustavo? Mathieu? anyone?
>

It is something new that breaks pybindgen scanning and the way code is being
split into different python files.  Basically, SimpleRefCount is a class
that belongs in module core, and so pybindgen tries to register this class,
with all seen template instantiations of that class, inside the module
'core'.  However, one such instantiation uses a type from module 'node', but
the types for that module are registered later.

I guess I'll have to fix pybindgen.  Tomorrow, maybe?...

-- 
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