Bug 2472 - Problems with iterators when compiling with -D_GLIBCXX_DEBUG
Problems with iterators when compiling with -D_GLIBCXX_DEBUG
Status: NEW
Product: ns-3
Classification: Unclassified
Component: lte
pre-release
PC Linux
: P5 enhancement
Assigned To: Biljana Bojović
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-07 16:56 EDT by Matthieu Coudron
Modified: 2016-09-06 12:07 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu Coudron 2016-08-07 16:56:03 EDT
For some reason, I've been trying to compile ns3 with -D_GLIBCXX_DEBUG () and here is the output wit gcc 5.4
===
../src/lte/model/cqa-ff-mac-scheduler.cc: In member function ‘void ns3::CqaFfMacScheduler::DoSchedDlTriggerReq(const ns3::FfMacSchedSapProvider::SchedDlTriggerReqParameters&)’:
../src/lte/model/cqa-ff-mac-scheduler.cc:1361:62: error: conversion from ‘std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)>::iterator {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)> >}’ to non-scalar type ‘ns3::t_it_HOLgroupToUEs {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::map<int, std::__debug::set<ns3::LteFlowId_t> > >}’ requested
   t_it_HOLgroupToUEs itGBRgroups = map_GBRHOLgroupToUE.begin ();
                                                              ^
../src/lte/model/cqa-ff-mac-scheduler.cc:1362:68: error: conversion from ‘std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)>::iterator {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)> >}’ to non-scalar type ‘ns3::t_it_HOLgroupToUEs {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::map<int, std::__debug::set<ns3::LteFlowId_t> > >}’ requested
   t_it_HOLgroupToUEs itnonGBRgroups = map_nonGBRHOLgroupToUE.begin ();
                                                                    ^
In file included from /usr/include/c++/5/map:60:0,
                 from ./ns3/log.h:27,
                 from ../src/lte/model/cqa-ff-mac-scheduler.cc:26:
/usr/include/c++/5/bits/stl_tree.h:237:7: error: ‘bool std::_Rb_tree_iterator<_Tp>::operator!=(const _Self&) const [with _Tp = std::pair<const int, std::__debug::set<ns3::LteFlowId_t> >; std::_Rb_tree_iterator<_Tp>::_Self = std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >]’ is inaccessible
       operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
       ^
../src/lte/model/cqa-ff-mac-scheduler.cc:1372:49: error: within this context
       if (itGBRgroups!=map_GBRHOLgroupToUE.end ())
                                                 ^
../src/lte/model/cqa-ff-mac-scheduler.cc:1372:49: error: ‘std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >’ is not an accessible base of ‘ns3::t_it_HOLgroupToUEs {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::map<int, std::__debug::set<ns3::LteFlowId_t> > >}’
../src/lte/model/cqa-ff-mac-scheduler.cc:1372:49: error: ‘std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >’ is an inaccessible base of ‘__gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)> >’
In file included from /usr/include/c++/5/map:60:0,
                 from ./ns3/log.h:27,
                 from ../src/lte/model/cqa-ff-mac-scheduler.cc:26:
/usr/include/c++/5/bits/stl_tree.h:237:7: error: ‘bool std::_Rb_tree_iterator<_Tp>::operator!=(const _Self&) const [with _Tp = std::pair<const int, std::__debug::set<ns3::LteFlowId_t> >; std::_Rb_tree_iterator<_Tp>::_Self = std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >]’ is inaccessible
       operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
       ^
../src/lte/model/cqa-ff-mac-scheduler.cc:1377:60: error: within this context
       else if (itnonGBRgroups!=map_nonGBRHOLgroupToUE.end ())                  // if there are no more flows with retransmission queue start to scheduler flows with transmission queue
                                                            ^
../src/lte/model/cqa-ff-mac-scheduler.cc:1377:60: error: ‘std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >’ is not an accessible base of ‘ns3::t_it_HOLgroupToUEs {aka __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::map<int, std::__debug::set<ns3::LteFlowId_t> > >}’
../src/lte/model/cqa-ff-mac-scheduler.cc:1377:60: error: ‘std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >’ is an inaccessible base of ‘__gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<const int, std::__debug::set<ns3::LteFlowId_t> > >, std::__debug::multimap<int, std::__debug::set<ns3::LteFlowId_t>, bool (*)(int, int)> >’
Build failed
 -> task in 'ns3-lte' failed (exit status 1): 
	{task 139826773034512: cxx cqa-ff-mac-scheduler.cc -> cqa-ff-mac-scheduler.cc.1.o}
['/usr/bin/g++', '-D_GLIBCXX_DEBUG', '-std=c++11', '-fPIC', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_=1', '-DHAVE_SQLITE3=1', '-DHAVE_GTK2=1', '-DHAVE_LIBXML2=1', '../src/lte/model/cqa-ff-mac-scheduler.cc', '-c', '-o', '/home/teto/ns3off/build/src/lte/model/cqa-ff-mac-scheduler.cc.1.o']
Waf: Leaving directory `/home/teto/ns3off/build'
Process terminated with status 1 (0 minute(s), 15 second(s))
10 error(s), 0 warning(s) (0 minute(s), 15 second(s))
==
Comment 1 Matthieu Coudron 2016-08-07 16:57:06 EDT
as ns3 now can benefit from C++11, "auto" declarations might be handy.
Comment 2 Biljana Bojović 2016-09-06 12:07:00 EDT
(In reply to Matthieu Coudron from comment #1)
> as ns3 now can benefit from C++11, "auto" declarations might be handy.

Hi Matthieu,

Thank you very much for reporting this issue. I understand that you suggest to change the type of iterator to auto, is this correct? Did you find that this solves all of these compile issues with gcc 5.4? 

I think that until we move completely to c++ 11 I cannot change it to "auto", since ns-3 currently supports gcc from 4.2 through 4.8. So, I guess that for the moment I need to search some solution that would fit with both, older and newer gcc. 

Best regards,
Biljana