tkn-tub / ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research
GNU General Public License v2.0
540 stars 199 forks source link

Cmake compilation issues ns3 #65

Closed zhouyou-gu closed 1 year ago

zhouyou-gu commented 2 years ago

Hello all,

I encounter some compilation issues when compiling the ns3gym. The first is

In member function ‘virtual bool ns3opengym::BoxSpace::MergePartialFromCodedStream(google::protobuf::io::CodedInputStream*)’:
/home/soyo/wifi-ai/ns-3-dev/cmake-build-debug/contrib/opengym/messages.pb.h:2139:10: error: ‘value’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2139 |   dtype_ = value;

It is solved when I disable Werror.

The second is

In file included from /usr/include/c++/9/complex.h:38,
                 from /home/soyo/wifi-ai/ns-3-dev/build/include/ns3/three-gpp-channel-model.h:25,
                 from /home/soyo/wifi-ai/ns-3-dev/build/include/ns3/spectrum-module.h:35,
                 from /home/soyo/wifi-ai/ns-3-dev/contrib/opengym/examples/interference-pattern/mygym.h:27,
                 from /home/soyo/wifi-ai/ns-3-dev/contrib/opengym/examples/interference-pattern/mygym.cc:21:
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:138:79: error: expected ‘>’ before ‘(’ token
  138 | template <typename V, typename T, template <typename...> class U, typename ...I,
      |                                                                               ^
In file included from /home/soyo/wifi-ai/ns-3-dev/build/include/ns3/core-module.h:19,
                 from /home/soyo/wifi-ai/ns-3-dev/contrib/opengym/examples/interference-pattern/mygym.cc:23:
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:142:29: error: expansion pattern ‘(__complex__ float){0.0f, 1.0e+0f}’ contains no parameter packs
  142 | DoMakeAccessorHelperOne (U<I...> T::*memberContainer)
      |                             ^~~
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:142:32: error: template argument 1 is invalid
  142 | DoMakeAccessorHelperOne (U<I...> T::*memberContainer)
      |                                ^
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h: In function ‘ns3::Ptr<const ns3::AttributeAccessor> ns3::DoMakeAccessorHelperOne(int T::*)’:
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:152:25: error: expansion pattern ‘(__complex__ float){0.0f, 1.0e+0f}’ contains no parameter packs
  152 |     MemberContainer (U<I...> T::*memberContainer)
      |                         ^~~
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:152:28: error: template argument 1 is invalid
  152 |     MemberContainer (U<I...> T::*memberContainer)
      |                            ^
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:180:8: error: expansion pattern ‘(__complex__ float){0.0f, 1.0e+0f}’ contains no parameter packs
  180 |     U<I...> T::*m_memberContainer;  // Address of the class data member.
      |        ^~~
/home/soyo/wifi-ai/ns-3-dev/build/include/ns3/attribute-container-accessor-helper.h:180:11: error: template argument 1 is invalid
  180 |     U<I...> T::*m_memberContainer;  // Address of the class data member.
      |           ^

This one is solved by removing the example folder and just compiling the models of ns3gym.

I am not so sure whether these are general problems or just happen in my setup (20.04-Ubuntu, ns-3.36.), and hopefully, there is some more elegant solution to them :).

Gabrielcarvfer commented 2 years ago
  1. Error
  2. Dumb issue caused by complex.h. Undefining I after its inclusion in three-gpp-channel-model.h:25 solves the issue.