Hello NS-3 community,
I was trying to run scratch-simulator.cc in clean installation of NS-3.36 (I'm using version 3.36 because it still supports the wave module).
After typing ./ns3 run scratch-simulator the simulator begins what seems like a build process which abruptly ends with an error which I assume originates from the C++ libraries.
This made me think that the problem is with the g++ compiler but I'm not 100% sure, that's why I'm asking here.
Here's the error with couple of lines preceding it:
[ 2%] Building CXX object src/olsr/CMakeFiles/libolsr-obj.dir/model/olsr-routing-protocol.cc.o
[ 2%] Building CXX object src/olsr/CMakeFiles/libolsr-obj.dir/model/olsr-state.cc.o
In file included from /usr/include/c++/12/bits/stl_map.h:63,
from /usr/include/c++/12/map:61,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/log.h:27,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/fatal-error.h:29,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/assert.h:56,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/ptr.h:26,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/attribute.h:25,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/build/include/ns3/length.h:24,
from /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/src/core/model/length.cc:21:
In constructor ‘constexpr std::_Head_base<_Idx, _Head, false>::_Head_base(_UHead&&) [with _UHead = ns3::Length::Unit&; long unsigned int _Idx = 1; _Head = ns3::Length::Unit]’,
inlined from ‘constexpr std::_Tuple_impl<_Idx, _Head>::_Tuple_impl(_UHead&&) [with _UHead = ns3::Length::Unit&; long unsigned int _Idx = 1; _Head = ns3::Length::Unit]’ at /usr/include/c++/12/tuple:441:38,
inlined from ‘constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(_UHead&&, _UTail&& ...) [with _UHead = bool&; _UTail = {ns3::Length::Unit&}; <template-parameter-2-3> = void; long unsigned int _Idx = 0; _Head = bool; _Tail = {ns3::Length::Unit}]’ at /usr/include/c++/12/tuple:292:38,
inlined from ‘constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = bool&; _U2 = ns3::Length::Unit&; typename std::enable_if<std::_TupleConstraints<(! __is_alloc_arg<_U1>()), _T1, _T2>::__is_implicitly_constructible<_U1, _U2>(), bool>::type <anonymous> = true; _T1 = bool; _T2 = ns3::Length::Unit]’ at /usr/include/c++/12/tuple:1079:63,
inlined from ‘constexpr std::tuple<typename std::__strip_reference_wrapper<typename std::decay<_Elements>::type>::__type ...> std::make_tuple(_Elements&& ...) [with _Elements = {bool&, ns3::Length::Unit&}]’ at /usr/include/c++/12/tuple:1581:62,
inlined from ‘std::tuple<bool, ns3::Length::Unit> ns3::FromString(std::string)’ at /home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/src/core/model/length.cc:666:38:
/usr/include/c++/12/tuple:200:11: error: ‘unit’ may be used uninitialized [-Werror=maybe-uninitialized]
200 | : _M_head_impl(std::forward<_UHead>(__h)) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/src/core/model/length.cc: In function ‘std::tuple<bool, ns3::Length::Unit> ns3::FromString(std::string)’:
/home/radovan/Desktop/FIIT/ns-allinone-3.36/ns-3.36/src/core/model/length.cc:658:16: note: ‘unit’ was declared here
658 | Length::Unit unit;
| ^~~~
cc1plus: all warnings being treated as errors
gmake[3]: *** [src/core/CMakeFiles/libcore-obj.dir/build.make:1028: src/core/CMakeFiles/libcore-obj.dir/model/length.cc.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:1746: src/core/CMakeFiles/libcore-obj.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:3713: scratch/CMakeFiles/scratch_scratch-simulator.dir/rule] Error 2
gmake: *** [Makefile:1418: scratch_scratch-simulator] Error 2
I am using:
Ubuntu 22.10
NS-3.36
g++ 12.2.0
python3 3.10.7
cmake 3.24.2
I'll gladly provide you with more information if needed.
I'm grateful for any piece of advice.
Thank you.
~Radovan