Bug 1221

Summary: Build errors in rev 7368 - ‘class ns3::Ipv4L3Protocol::Fragments’ is private
Product: ns-3 Reporter: Claudio <claudio-daniel.freire>
Component: python bindingsAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh, tommaso.pecorella
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Config log
Scan log
Build log

Description Claudio 2011-07-18 06:13:50 UTC
I did an hg pull and now I get these:

[1292/1686] cxx: src/propagation/examples/main-propagation-loss.cc -> build/optimized/src/propagation/examples/main-propagation-loss_1.o
In file included from optimized/src/internet/bindings/ns3module.cc:1:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.h:2829: error: within this context
optimized/ns3/global-router-interface.h: In constructor ‘PyNs3GlobalRouter__PythonHelper::PyNs3GlobalRouter__PythonHelper()’:
optimized/ns3/global-router-interface.h:711: error: ‘ns3::GlobalRouter::~GlobalRouter()’ is private
optimized/src/internet/bindings/ns3module.h:3430: error: within this context
optimized/ns3/global-router-interface.h: In destructor ‘virtual PyNs3GlobalRouter__PythonHelper::~PyNs3GlobalRouter__PythonHelper()’:
optimized/ns3/global-router-interface.h:711: error: ‘ns3::GlobalRouter::~GlobalRouter()’ is private
optimized/src/internet/bindings/ns3module.h:3442: error: within this context
optimized/ns3/ipv4-l3-protocol.h: In function ‘int _wrap_PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt____tp_init__0(PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt__*, PyObject*, PyObject*, PyObject**)’:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.cc:27275: error: within this context
optimized/ns3/ipv4-l3-protocol.h: In function ‘int _wrap_PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt____tp_init__1(PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt__*, PyObject*, PyObject*, PyObject**)’:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.cc:27295: error: within this context
optimized/ns3/ipv4-l3-protocol.h: In function ‘PyObject* _wrap_PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt____copy__(PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt__*)’:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.cc:27343: error: within this context
optimized/ns3/ipv4-l3-protocol.h: In function ‘void _wrap_PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt____tp_dealloc(PyNs3SimpleRefCount__Ns3Ipv4L3ProtocolFragments_Ns3Empty_Ns3DefaultDeleter__lt__ns3Ipv4L3ProtocolFragments__gt__*)’:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.cc:27365: error: within this context
[1293/1686] cxx: build/optimized/src/propagation/bindings/ns3module.cc -> build/optimized/src/propagation/bindings/ns3module_5.o
optimized/ns3/ipv4-l3-protocol.h: In function ‘void initinternet()’:
optimized/ns3/ipv4-l3-protocol.h:324: error: ‘class ns3::Ipv4L3Protocol::Fragments’ is private
optimized/src/internet/bindings/ns3module.cc:75425: error: within this context
Waf: Leaving directory `/home/cdfreire/src/ns-3-mainline-dev-clean-really/build'
Build failed:  -> task failed (err #1): 
	{task: cxx ns3module.cc -> ns3module_5.o}


I got it at rev 7368, but I believe they were introduced at 7366
Comment 1 Tommaso Pecorella 2011-07-18 08:57:35 UTC
(In reply to comment #0)
> I did an hg pull and now I get these:
>
> [...] 
> 
> I got it at rev 7368, but I believe they were introduced at 7366

It was introduced in rev 7366 for sure, and I think it's due to the Python bindings being still "old". Unfortunately I cannot rebuild them due to missing libraries on MacOS, but it should be enough to fix the issue.

Also a distclean and rebuild might help.

Can you check what happens without Python bindings and/or after a distclean ?

Cheers,

Tommaso
Comment 2 Tom Henderson 2011-07-18 10:25:37 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > I did an hg pull and now I get these:
> >
> > [...] 
> > 
> > I got it at rev 7368, but I believe they were introduced at 7366
> 
> It was introduced in rev 7366 for sure, and I think it's due to the Python
> bindings being still "old". Unfortunately I cannot rebuild them due to missing
> libraries on MacOS, but it should be enough to fix the issue.
> 
> Also a distclean and rebuild might help.
> 
> Can you check what happens without Python bindings and/or after a distclean ?
> 
> Cheers,
> 
> Tommaso

I'm not able to rescan bindings with ns-3-dev and pybindgen this morning; will have Gustavo look at this issue.
Comment 3 Claudio 2011-07-18 11:18:36 UTC
(In reply to comment #2)
> I'm not able to rescan bindings with ns-3-dev and pybindgen this morning; will
> have Gustavo look at this issue.

Me neither.

Or, rather, I can scan them, but the resulting bindings don't seem correct at all. Like GlobalRouter, it should be a wrapper object, since it inherits from Object and all Object derived classes should be accessed through a wrapper according to ns3modulegen_core_customizations.py:Object_customizations, but inspecting build/optimized/src/internet/bindings/ns3module.h, it's not a proper wrapper:

typedef struct {
    PyObject_HEAD
    ns3::GlobalRouter *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyNs3GlobalRouter;

extern PyTypeObject PyNs3GlobalRouter_Type;

class PyNs3GlobalRouter__PythonHelper : public ns3::GlobalRouter
{
...
};

NS_OBJECT_ENSURE_REGISTERED (PyNs3GlobalRouter__PythonHelper);


I'll attach complete logs
Comment 4 Claudio 2011-07-18 11:19:19 UTC
Created attachment 1206 [details]
Config log
Comment 5 Claudio 2011-07-18 11:19:38 UTC
Created attachment 1207 [details]
Scan log
Comment 6 Claudio 2011-07-18 11:19:55 UTC
Created attachment 1208 [details]
Build log
Comment 7 Tommaso Pecorella 2011-07-18 12:50:42 UTC
Ok, I found a virtual machine with PyBindGen and everything else. Ubuntu 11.04 to be precise.

The compilation goes fine, no error running ./waf.

I got an error rebuilding the Python bindings tho:

RuntimeError: pygccxml error: file '/home/pecos/ns-3-allinone/ns-3-dev/build/debug/bindings/python/everything.h' does not exist

To be hones I can't reproduce the original bug, so I'm puzzled about it. Moreover I have tested it for a long time and I doubt that it is due to a C++ error (but I can't exclude either).

The configuration output (to check what options I have enabled) is:


pecos@pecos-VirtualBox:~/ns-3-allinone/ns-3-dev$ ./waf configure --enable-examples
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program pkg-config          : /usr/bin/pkg-config 
Checking for -Wl,--soname=foo support    : yes 
Checking for type uint128_t              : not found 
Checking for type __uint128_t            : not found 
Checking for high precision time implementation : cairo 128-bit integer 
Checking for header stdint.h                    : yes 
Checking for header inttypes.h                  : yes 
Checking for header sys/inttypes.h              : not found 
Checking for header stdlib.h                    : yes 
Checking for header signal.h                    : yes 
Checking for header pthread.h                   : yes 
Checking for header stdint.h                    : yes 
Checking for header inttypes.h                  : yes 
Checking for header sys/inttypes.h              : not found 
Checking for library rt                         : yes 
Checking for header netpacket/packet.h          : yes 
Checking for header linux/if_tun.h              : yes 
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
Checking for pkg-config flags for GTK_CONFIG_STORE  : not found 
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Checking for pkg-config flags for LIBXML2           : not found 
Checking for NSC location                           : ok ../nsc (guessed) 
Checking for library dl                             : yes 
Checking for NSC supported architecture i686        : ok  
Checking for header sys/socket.h                    : yes 
Checking for header netinet/in.h                    : yes 
Checking for click location                         : not found 
boost headers                                       : Version 1_42 (/usr/include) 
library boost_signals                               : ok 
library boost_filesystem                            : ok 
Checking for OpenFlow location                      : not found 
Checking for library sqlite3                        : not found 
Checking for program python                         : /usr/bin/python 
Checking for Python version >= 2.3                  : ok 2.7.1 
Checking for library python2.7                      : yes 
Checking for program python2.7-config               : /usr/bin/python2.7-config 
Checking for header Python.h                        : yes 
Checking for -fvisibility=hidden support            : yes 
Checking for pybindgen location                     : ok ../pybindgen (guessed) 
Checking for Python module pybindgen                : ok  
Checking for pybindgen version                      : ok 0.15.0.790 
Checking for types uint64_t and unsigned long equivalency : no 
Checking for types uint64_t and unsigned long long equivalency : yes 
Checking for the apidefs that can be used for Python bindings  : gcc-ILP32 
Checking for type of bindings to build                         : modular 
Checking for Python module pygccxml                            : ok  
Checking for pygccxml version                                  : ok 1.0.0 
Checking for program gccxml                                    : /usr/bin/gccxml 
Checking for gccxml version                                    : ok 0.9.0 
Checking for program mpic++                                    : not found 
Checking for program sudo                                      : /usr/bin/sudo 
Checking for program valgrind                                  : /usr/bin/valgrind 
Checking for pkg-config flags for GSL                          : ok  
Checking for -Wno-error=deprecated-declarations support        : yes 
Checking for -Wno-error=deprecated-declarations support        : yes 
Checking for -fstrict-aliasing support                         : yes 
Checking for -fstrict-aliasing support                         : yes 
Checking for -Wstrict-aliasing support                         : yes 
Checking for -Wstrict-aliasing support                         : yes 
Checking for program doxygen                                   : not found 
---- Summary of optional NS-3 features:
Static build                  : not enabled (option --enable-static not selected)
Threading Primitives          : enabled
Real Time Simulator           : enabled
Emulated Net Device           : enabled
Tap Bridge                    : enabled
GtkConfigStore                : not enabled (library 'gtk+-2.0 >= 2.12' not found)
XmlIo                         : not enabled (library 'libxml-2.0 >= 2.7' not found)
Network Simulation Cradle     : enabled
NS-3 Click Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (OpenFlow not enabled (see option --with-openflow))
SQlite stats data output      : not enabled (library 'sqlite3' not found)
Python Bindings               : enabled
Python API Scanning Support   : enabled
MPI Support                   : not enabled (option --enable-mpi not selected)
Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
Build tests                   : not enabled (defaults to disabled)
Build examples                : enabled
GNU Scientific Library (GSL)  : enabled
'configure' finished successfully (12.980s)
Comment 8 Claudio 2011-07-18 12:55:47 UTC
(In reply to comment #7)
> To be hones I can't reproduce the original bug, so I'm puzzled about it.

I was pretty sure I used a clean checkout to build, but just in case I'll do it again, clean checkout, and post on the results.
Comment 9 Claudio 2011-07-19 04:26:40 UTC
Ok, it seems you're right.

A clean checkout works fine.

So the problem isn't on the committed bindings, but rather that ./waf clean or distclean plus hg revert --all doesn't seem to undo the damage of a messed ./waf --apiscan=all

Also, that ./waf --apiscan=all doesn't work anymore. That's a problem, because I really need to re-scan them (after applying a patch).
Comment 10 Claudio 2011-07-19 04:32:55 UTC
For the record, the steps to reproduce:

$ hg clone http://www.nsnam.org/ns-3-dev 
$ cd ns-3-dev
$ ./waf configure -d optimized --enable-tests --enable-examples
$ ./waf --apiscan=all
$ ./waf
<<breaks>>
<<oops>>
$ ./waf distclean
$ hg revert --all # to clean broken apidefs
$ ./waf configure -d optimized --enable-tests --enable-examples
$ ./waf
<<breaks>>
<<only way to fix is a clean checkout>>
Comment 11 Tom Henderson 2011-07-19 12:18:13 UTC
reassigning to Gustavo since it seems to be a new bindings issue
Comment 12 Gustavo J. A. M. Carneiro 2011-07-19 14:50:56 UTC
changeset:   7372:7e94bfc77819
tag:         tip
user:        Gustavo J. A. M. Carneiro  <gjc@inescporto.pt>
date:        Tue Jul 19 19:50:05 2011 +0100
summary:     Rescan api of the internet module

changeset:   7371:7edd1a3c0f9f
user:        Gustavo J. A. M. Carneiro  <gjc@inescporto.pt>
date:        Tue Jul 19 19:49:51 2011 +0100
summary:     Upgrade pybindgen
Comment 13 Claudio 2011-07-20 05:43:32 UTC
./waf --apiscan=all keeps barking, this time:

    [1337/1684] cxx: build/optimized/src/netanim/bindings/ns3module.cc -> build/optimized/src/netanim/bindings/ns3module_4.o
    optimized/src/netanim/bindings/ns3module.cc: In function ‘PyObject* initnetanim_Config()’:
    optimized/src/netanim/bindings/ns3module.cc:527: error: return-statement with no value, in function returning ‘PyObject*’
    Waf: Leaving directory `/auto/sop-nas2a/u/sop-nas2a/vol/home_planete/cdfreire/src/ns-3-mainline-dev-clean-really/build'

If I change the "return;" to "return NULL;" manually (on that line), it builds fine.

I tried looking at pybindgen but I can't find an easy way to make it issue a "return NULL;" there (and only there), the _generate_import_from_module function is used in many contexts where the bare return is fine.
Comment 14 Claudio 2011-07-20 06:41:54 UTC
Correction, I found the problem in pybindgen.

I'll create an issue in pybindgen, lets re-close this thing.