tkn-tub / ns3-gym

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

Porting to ns 3.36 #63

Open prototact opened 2 years ago

prototact commented 2 years ago

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

ahmadmr81 commented 2 years ago

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

prototact commented 2 years ago

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

ahmadmr81 commented 2 years ago

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)

rukyr97 commented 2 years ago

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

ahmadmr81 commented 2 years ago

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.

rukyr97 commented 2 years ago

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.

pgawlowicz commented 2 years ago

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

mhmd97z commented 1 year ago

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.

rukyr97 commented 1 year ago

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...