ns3-gym icon indicating copy to clipboard operation
ns3-gym copied to clipboard

Porting to ns 3.36

Open prototact opened this issue 2 years ago • 9 comments

Hi! Are there some general directions on how to port the module to ns 3.36 ?

prototact avatar Jun 22 '22 14:06 prototact

I second this. I tried installing NS3-Gym in NS3-3.36.1 (including converting wscript files to CMakeLists.txt), but I am facing to many errors while building it.

(Just a note, using NS3-3.35 is OK, however, I am using other tools that are built for NS3-3.36 and it is difficult for me to convert them to work on NS3-3.35)

I hope the developers consider this soon

ahmadmr81 avatar Jun 28 '22 17:06 ahmadmr81

I worked on it a bit, and currently it is good enough. I attach two files, a CMakeLists.txt that needs to be added in the opengym directory and a start_sim script that goes into the opengym/model/ns3gym/ns3gym subdirectory.

opengym-assist.zip

prototact avatar Jun 29 '22 08:06 prototact

Thank you, prototact, for the files. They were very helpful to me (I am a beginner in the CMake world). However, I still get the same errors:

_> In file included from /home/*******/ns-allinone-3.36.1/ns-3.36.1/contrib/opengym/model/opengym_interface.h:26,

             from /home/*******/ns-allinone-3.36.1/ns-3.36.1/contrib/opengym/model/opengym_interface.cc:27:

/usr/include/zmq.hpp:638:14: error: ‘ZMQ_BLOCKY’ was not declared in this scope; did you mean ‘ZMQ_NOBLOCK’? 638 | blocky = ZMQ_BLOCKY, | ^~~~~~~~~~ | ZMQ_NOBLOCK /usr/include/zmq.hpp:642:31: error: ‘ZMQ_THREAD_AFFINITY_CPU_ADD’ was not declared in this scope 642 | thread_affinity_cpu_add = ZMQ_THREAD_AFFINITY_CPU_ADD, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:643:34: error: ‘ZMQ_THREAD_AFFINITY_CPU_REMOVE’ was not declared in this scope 643 | thread_affinity_cpu_remove = ZMQ_THREAD_AFFINITY_CPU_REMOVE, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:644:26: error: ‘ZMQ_THREAD_NAME_PREFIX’ was not declared in this scope 644 | thread_name_prefix = ZMQ_THREAD_NAME_PREFIX, | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:645:17: error: ‘ZMQ_MAX_MSGSZ’ was not declared in this scope; did you mean ‘ZMQ_MAXMSGSIZE’? 645 | max_msgsz = ZMQ_MAX_MSGSZ, | ^~~~~~~~~~~~~ | ZMQ_MAXMSGSIZE /usr/include/zmq.hpp:652:18: error: ‘ZMQ_MSG_T_SIZE’ was not declared in this scope 652 | msg_t_size = ZMQ_MSG_T_SIZE | ^~~~~~~~~~~~~~ In file included from /home//ns-allinone-3.36.1/ns-3.36.1/contrib/opengym/model/opengym_interface.h:26, from /home//ns-allinone-3.36.1/ns-3.36.1/contrib/opengym/model/opengym_env.cc:27: /usr/include/zmq.hpp:638:14: error: ‘ZMQ_BLOCKY’ was not declared in this scope; did you mean ‘ZMQ_NOBLOCK’? 638 | blocky = ZMQ_BLOCKY, | ^~~~~~~~~~ | ZMQ_NOBLOCK /usr/include/zmq.hpp:642:31: error: ‘ZMQ_THREAD_AFFINITY_CPU_ADD’ was not declared in this scope 642 | thread_affinity_cpu_add = ZMQ_THREAD_AFFINITY_CPU_ADD, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:643:34: error: ‘ZMQ_THREAD_AFFINITY_CPU_REMOVE’ was not declared in this scope 643 | thread_affinity_cpu_remove = ZMQ_THREAD_AFFINITY_CPU_REMOVE, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:644:26: error: ‘ZMQ_THREAD_NAME_PREFIX’ was not declared in this scope 644 | thread_name_prefix = ZMQ_THREAD_NAME_PREFIX, | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/zmq.hpp:645:17: error: ‘ZMQ_MAX_MSGSZ’ was not declared in this scope; did you mean ‘ZMQ_MAXMSGSIZE’? 645 | max_msgsz = ZMQ_MAX_MSGSZ, | ^~~~~~~~~~~~~ | ZMQ_MAXMSGSIZE /usr/include/zmq.hpp:652:18: error: ‘ZMQ_MSG_T_SIZE’ was not declared in this scope 652 | msg_t_size = ZMQ_MSG_T_SIZE | ^~~~~~~~~~~~~~ make[2]: *** [contrib/opengym/CMakeFiles/libopengym-obj.dir/build.make:115: contrib/opengym/CMakeFiles/libopengym-obj.dir/model/opengym_env.cc.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: *** [contrib/opengym/CMakeFiles/libopengym-obj.dir/build.make:63: contrib/opengym/CMakeFiles/libopengym-obj.dir/model/opengym_interface.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:5064: contrib/opengym/CMakeFiles/libopengym-obj.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 Finished executing the following commands: cd cmake-cache; cmake --build . -j 11 ; cd .._

This error happened after I also copied the zmq.hpp file from the ZeroMQ repository.

Anyone is facing these errors? it only occurs with NS3-3.36.x version, not with previous versions (e.g., 3.35)

ahmadmr81 avatar Jul 01 '22 10:07 ahmadmr81

I'm also not succeeding to patch the porting with the examples you provided @prototact The image below shows the output of ./ns3 configure after moving the files to the directories you mentioned.

image

rukyr97 avatar Jul 05 '22 13:07 rukyr97

I'm also not succeeding to patch the porting with the examples you provided @prototact The image below shows the output of ./ns3 configure after moving the files to the directories you mentioned.

Here is the corrected CMakeLists.txt file. @prototact had a couple of missed brackets :) However, NS3-Gym still won't work.

Another point: NS3-Gym requires SQLite to be installed.

ahmadmr81 avatar Jul 05 '22 13:07 ahmadmr81

I'm also not succeeding to patch the porting with the examples you provided @prototact The image below shows the output of ./ns3 configure after moving the files to the directories you mentioned.

Here is the corrected CMakeLists.txt file. @prototact had a couple of missed brackets :) However, NS3-Gym still won't work.

Another point: NS3-Gym requires SQLite to be installed.

Thank you for the quick reply @ahmadmr81 ... I decided to run an older version of ns-3.35 as i have no experience in porting software. I'd be glad to help contributing if someone could provide me some guidelines on how to do it.

rukyr97 avatar Jul 05 '22 14:07 rukyr97

Hi Orfeas (@prototact), Thank you for the provided files. I have applied your changes to the start_sim.py file and pushed it into a new branch. BR, Piotr

pgawlowicz avatar Jul 07 '22 08:07 pgawlowicz

I have a problem porting the module to ns3.36 even with the two files provided.

I get the following error when I run "./ns3"

../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::internal::WireFormatLite::SkipField(google::protobuf::io::CodedInputStream*, unsigned int)'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::MessageLite::ParseFromArray(void const*, int)'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::internal::VerifyVersion(int, int, char const*)'

The complete output of "./ns3 build" can be found here.

And in the output of "./ns3 configure" :

-- Processing src/opengym
-- find_external_library: zmq was found.
Protobuf messages generated, good!
Protobuf messages generated, good!
...

More in detail, I have successfully compiled opengym in previous versions of ns3 using waf on the same machine, so I guess there should be sth wrong with new CMake stuff.

mhmd97z avatar Aug 11 '22 10:08 mhmd97z

I have a problem porting the module to ns3.36 even with the two files provided.

I get the following error when I run "./ns3"

../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::internal::WireFormatLite::SkipField(google::protobuf::io::CodedInputStream*, unsigned int)'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::MessageLite::ParseFromArray(void const*, int)'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../../build/lib/libns3.36.1-opengym-default.so: undefined reference to `google::protobuf::internal::VerifyVersion(int, int, char const*)'

The complete output of "./ns3 build" can be found here.

And in the output of "./ns3 configure" :

-- Processing src/opengym
-- find_external_library: zmq was found.
Protobuf messages generated, good!
Protobuf messages generated, good!
...

More in detail, I have successfully compiled opengym in previous versions of ns3 using waf on the same machine, so I guess there should be sth wrong with new CMake stuff.

I opened a new issue but actually im having exactly the same errors...

rukyr97 avatar Aug 12 '22 14:08 rukyr97