Problem with running simulation in NS-3.36

43 views
Skip to first unread message

Radovan Záborský

unread,
Sep 27, 2024, 11:12:04 AM9/27/24
to ns-3-users
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

Gabriel Ferreira

unread,
Sep 28, 2024, 2:56:33 PM9/28/24
to ns-3-users
New compiler, new warnings. By default, we enable warnings as errors, so this is why it fails.
You can disable the warnings as errors. `./ns3 configure --disable-werror`, or `cmake -DNS3_WARNINGS_AS_ERRORS=OFF`

Radovan Záborský

unread,
Sep 29, 2024, 5:15:34 AM9/29/24
to ns-3-users
Thank you !
Dátum: sobota 28. septembra 2024, čas: 20:56:33 UTC+2, odosielateľ: Gabriel Ferreira
Reply all
Reply to author
Forward
0 new messages